From 75ab03dc85b27de66a78be8ddad2f697a90f4943 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 22 Apr 2012 10:59:14 +0200 Subject: [PATCH] Jasmine: Convert any matching tests --- spec/generated-parser.spec.js | 16 ++++++++++++++++ test/compiler-test.js | 14 -------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/spec/generated-parser.spec.js b/spec/generated-parser.spec.js index fddd272..cba568e 100644 --- a/spec/generated-parser.spec.js +++ b/spec/generated-parser.spec.js @@ -137,4 +137,20 @@ describe("generated parser", function() { }); }); }); + + describe("any matching", function() { + varyAll(function(options) { + it("matches correctly", function() { + var parser = PEG.buildParser('start = .', options); + + expect(parser).toParse("a", "a"); + }); + + it("advances position on success", function() { + var parser = PEG.buildParser('start = . .', options); + + expect(parser).toParse("ab", ["a", "b"]); + }); + }); + }); }); diff --git a/test/compiler-test.js b/test/compiler-test.js index 5e9d34f..52f42b2 100644 --- a/test/compiler-test.js +++ b/test/compiler-test.js @@ -643,20 +643,6 @@ testWithVaryingTrackLineAndColumn("rule references", function(options) { parses(parser, "Python", "Python"); }); -testWithVaryingTrackLineAndColumn("anys", function(options) { - var parser = PEG.buildParser('start = .', options); - parses(parser, "a", "a"); - doesNotParse(parser, ""); - doesNotParse(parser, "ab"); - - /* - * Test that the parsing position moves forward after successful parsing of - * an any. - */ - var posTestParser = PEG.buildParser('start = . .', options); - parses(posTestParser, "ab", ["a", "b"]); -}); - testWithVaryingTrackLineAndColumn("classes", function(options) { var emptyClassParser = PEG.buildParser('start = []', options); doesNotParse(emptyClassParser, "");