Skip to content

Commit

Permalink
test(patterns): revert error msg improvement that breaks old tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jun 15, 2023
1 parent c224a3c commit 2acdc48
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions packages/patterns/src/patterns/patternMatchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,20 +941,31 @@ const makePatternKit = () => {
return false;
}
const { label } = remotableDesc;
const passStyle = passStyleOf(specimen);
const kindDetails =
passStyle !== 'tagged'
? // Pass style can be embedded in details without quotes.
b(passStyle)
: // Tag must be quoted because it is potentially attacker-controlled
// (unlike `kindOf`, this does not reject unrecognized tags).
q(getTag(specimen));
return check(
false,
// `label` can be embedded without quotes because it is provided by
// local code like `M.remotable("...")`.
X`${specimen} - Must be a remotable ${b(label)}, not ${kindDetails}`,
X`${specimen} - Must be a remotable (${b(label)})`,
);
// We would like to use the commented out code below rather than the
// the similar code immediately above. The new code improves the error
// message, which is great. However, currently agoric-sdk has tests that
// depend on the error message emitted by the code above.
// TODO use the code below when we can.
//
// const passStyle = passStyleOf(specimen);
// const kindDetails =
// passStyle !== 'tagged'
// ? // Pass style can be embedded in details without quotes.
// b(passStyle)
// : // Tag must be quoted because it is potentially attacker-controlled
// // (unlike `kindOf`, this does not reject unrecognized tags).
// q(getTag(specimen));
// return check(
// false,
// // `label` can be embedded without quotes because it is provided by
// // local code like `M.remotable("...")`.
// X`${specimen} - Must be a remotable ${b(label)}, not ${kindDetails}`,
},

checkIsWellFormed: (allegedRemotableDesc, check) =>
Expand Down

0 comments on commit 2acdc48

Please sign in to comment.