From 669668fc1b2f557fdf77810a5574c6766d1d7869 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 22 Apr 2012 11:27:17 +0200 Subject: [PATCH] Jasmine: Convert zero or more matching tests --- spec/generated-parser.spec.js | 12 ++++++++++++ test/compiler-test.js | 7 ------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/spec/generated-parser.spec.js b/spec/generated-parser.spec.js index fd1b536..82588f5 100644 --- a/spec/generated-parser.spec.js +++ b/spec/generated-parser.spec.js @@ -91,6 +91,18 @@ describe("generated parser", function() { }); }); + describe("zero or more matching", function() { + varyAll(function(options) { + it("matches correctly", function() { + var parser = PEG.buildParser('start = "a"*', options); + + expect(parser).toParse("", []); + expect(parser).toParse("a", ["a"]); + expect(parser).toParse("aaa", ["a", "a", "a"]); + }); + }); + }); + describe("one or more matching", function() { varyAll(function(options) { it("matches correctly", function() { diff --git a/test/compiler-test.js b/test/compiler-test.js index bf874ab..51eb6c0 100644 --- a/test/compiler-test.js +++ b/test/compiler-test.js @@ -435,13 +435,6 @@ testWithVaryingTrackLineAndColumn("optional expressions", function(options) { parses(parser, "a", "a"); }); -testWithVaryingTrackLineAndColumn("zero or more expressions", function(options) { - var parser = PEG.buildParser('start = "a"*', options); - parses(parser, "", []); - parses(parser, "a", ["a"]); - parses(parser, "aaa", ["a", "a", "a"]); -}); - testWithVaryingTrackLineAndColumn("initializer", function(options) { var variableInActionParser = PEG.buildParser( '{ a = 42; }; start = "a" { return a; }',