diff --git a/spec/generated-parser.spec.js b/spec/generated-parser.spec.js index c8a7158..43fa0f3 100644 --- a/spec/generated-parser.spec.js +++ b/spec/generated-parser.spec.js @@ -91,6 +91,23 @@ describe("generated parser", function() { }); }); + describe("simple not matching", function() { + varyAll(function(options) { + it("matches correctly", function() { + var parser = PEG.buildParser('start = !"a" "b"', options); + + expect(parser).toParse("b", ["", "b"]); + expect(parser).toFailToParse("a"); + }); + + it("does not advance position on failure", function() { + var parser = PEG.buildParser('start = !"a" / "a"', options); + + expect(parser).toParse("a", "a"); + }); + }); + }); + describe("semantic and code", function() { varyAll(function(options) { it("causes successful match by returning |true|", function() { diff --git a/test/compiler-test.js b/test/compiler-test.js index 48f2df9..c1e1d76 100644 --- a/test/compiler-test.js +++ b/test/compiler-test.js @@ -60,19 +60,6 @@ testWithVaryingTrackLineAndColumn("simple and", function(options) { */ }); -testWithVaryingTrackLineAndColumn("simple not", function(options) { - var parser = PEG.buildParser('start = "a" !"b"', options); - parses(parser, "a", ["a", ""]); - doesNotParse(parser, "ab"); - - /* - * Test that the parsing position returns after successful parsing of a - * predicate. - */ - var posTestParser = PEG.buildParser('start = "a" !"b" "c"'); - parses(posTestParser, "ac", ["a", "", "c"]); -}); - testWithVaryingTrackLineAndColumn("initializer", function(options) { var variableInActionParser = PEG.buildParser( '{ a = 42; }; start = "a" { return a; }',