From ccf31f8822170bad7dca85e1b78fb7f9f9b84879 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 22 Apr 2012 11:31:15 +0200 Subject: [PATCH] Jasmine: Convert optional matching tests --- spec/generated-parser.spec.js | 11 +++++++++++ test/compiler-test.js | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) 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; }',