diff --git a/spec/generated-parser.spec.js b/spec/generated-parser.spec.js index 82588f5..316efe8 100644 --- a/spec/generated-parser.spec.js +++ b/spec/generated-parser.spec.js @@ -91,6 +91,17 @@ describe("generated parser", function() { }); }); + describe("optional matching", function() { + varyAll(function(options) { + it("matches correctly", function() { + var parser = PEG.buildParser('start = "a"?', options); + + expect(parser).toParse("", ""); + expect(parser).toParse("a", "a"); + }); + }); + }); + describe("zero or more matching", function() { varyAll(function(options) { it("matches correctly", function() { diff --git a/test/compiler-test.js b/test/compiler-test.js index 51eb6c0..0cf4c9c 100644 --- a/test/compiler-test.js +++ b/test/compiler-test.js @@ -429,12 +429,6 @@ test("semantic not (with trackLineAndColumn: true)", function() { parses(digitsParser, "1\u2029x", [2, 1]); // paragraph separator }); -testWithVaryingTrackLineAndColumn("optional expressions", function(options) { - var parser = PEG.buildParser('start = "a"?', options); - parses(parser, "", ""); - parses(parser, "a", "a"); -}); - testWithVaryingTrackLineAndColumn("initializer", function(options) { var variableInActionParser = PEG.buildParser( '{ a = 42; }; start = "a" { return a; }',