Behavior specs cleanup: Improve error reporting specs
This commit is contained in:
parent
e9d038547d
commit
e306b58443
|
@ -1090,7 +1090,7 @@ describe("generated parser behavior", function() {
|
||||||
'start = line (nl+ line)*',
|
'start = line (nl+ line)*',
|
||||||
'line = digit (" "+ digit)*',
|
'line = digit (" "+ digit)*',
|
||||||
'digit = [0-9]',
|
'digit = [0-9]',
|
||||||
'nl = ("\\r" / "\\n" / "\\u2028" / "\\u2029")'
|
'nl = [\\r\\n\\u2028\\u2029]'
|
||||||
].join("\n"), options);
|
].join("\n"), options);
|
||||||
|
|
||||||
expect(parser).toFailToParse("1\n2\n\n3\n\n\n4 5 x", {
|
expect(parser).toFailToParse("1\n2\n\n3\n\n\n4 5 x", {
|
||||||
|
@ -1100,29 +1100,29 @@ describe("generated parser behavior", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Non-Unix newlines */
|
/* Non-Unix newlines */
|
||||||
expect(parser).toFailToParse("1\rx", { // Old Mac
|
expect(parser).toFailToParse("1\rx", { // Old Mac
|
||||||
offset: 2,
|
offset: 2,
|
||||||
line: 2,
|
line: 2,
|
||||||
column: 1
|
column: 1
|
||||||
});
|
});
|
||||||
expect(parser).toFailToParse("1\r\nx", { // Windows
|
expect(parser).toFailToParse("1\r\nx", { // Windows
|
||||||
offset: 3,
|
offset: 3,
|
||||||
line: 2,
|
line: 2,
|
||||||
column: 1
|
column: 1
|
||||||
});
|
});
|
||||||
expect(parser).toFailToParse("1\n\rx", { // mismatched
|
expect(parser).toFailToParse("1\n\rx", { // mismatched
|
||||||
offset: 3,
|
offset: 3,
|
||||||
line: 3,
|
line: 3,
|
||||||
column: 1
|
column: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Strange newlines */
|
/* Strange newlines */
|
||||||
expect(parser).toFailToParse("1\u2028x", { // line separator
|
expect(parser).toFailToParse("1\u2028x", { // line separator
|
||||||
offset: 2,
|
offset: 2,
|
||||||
line: 2,
|
line: 2,
|
||||||
column: 1
|
column: 1
|
||||||
});
|
});
|
||||||
expect(parser).toFailToParse("1\u2029x", { // paragraph separator
|
expect(parser).toFailToParse("1\u2029x", { // paragraph separator
|
||||||
offset: 2,
|
offset: 2,
|
||||||
line: 2,
|
line: 2,
|
||||||
column: 1
|
column: 1
|
||||||
|
|
Loading…
Reference in a new issue