Skip to content

Commit

Permalink
Improve oneOf error message by wrapping in quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJohz committed Jun 15, 2018
1 parent 4017730 commit 7a9cee0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parsimmon.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,9 +929,13 @@ function test(predicate) {
}

function oneOf(str) {
var expected = str.split("");
for (var idx = 0; idx < expected.length; idx++) {
expected[idx] = "'" + expected[idx] + "'";
}
return test(function(ch) {
return str.indexOf(ch) >= 0;
}).desc(str.split(""));
}).desc(expected);
}

function noneOf(str) {
Expand Down

0 comments on commit 7a9cee0

Please sign in to comment.