From b06bd774f5d268e0d1f19b9cd8a070b8e7ca3f54 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 22 Apr 2012 11:12:30 +0200 Subject: [PATCH] Jasmine: Convert rule reference matching tests --- spec/generated-parser.spec.js | 15 +++++++++++++++ test/compiler-test.js | 10 ---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/spec/generated-parser.spec.js b/spec/generated-parser.spec.js index 307d376..a26fce6 100644 --- a/spec/generated-parser.spec.js +++ b/spec/generated-parser.spec.js @@ -91,6 +91,21 @@ describe("generated parser", function() { }); }); + describe("rule reference matching", function() { + varyAll(function(options) { + it("follows rule references", function() { + var parser = PEG.buildParser([ + 'start = static / dynamic', + 'static = "C" / "C++" / "Java" / "C#"', + 'dynamic = "Ruby" / "Python" / "JavaScript"' + ].join("\n"), options); + + expect(parser).toParse("Java", "Java"); + expect(parser).toParse("Python", "Python"); + }); + }); + }); + describe("literal matching", function() { varyAll(function(options) { it("matches empty literal correctly", function() { diff --git a/test/compiler-test.js b/test/compiler-test.js index 9878ff3..3de8cd8 100644 --- a/test/compiler-test.js +++ b/test/compiler-test.js @@ -633,16 +633,6 @@ testWithVaryingTrackLineAndColumn("initializer", function(options) { parses(functionInSemanticNotParser, "a", ["a", ""]); }); -testWithVaryingTrackLineAndColumn("rule references", function(options) { - var parser = PEG.buildParser([ - 'start = static / dynamic', - 'static = "C" / "C++" / "Java" / "C#"', - 'dynamic = "Ruby" / "Python" / "JavaScript"' - ].join("\n"), options); - parses(parser, "Java", "Java"); - parses(parser, "Python", "Python"); -}); - testWithVaryingTrackLineAndColumn("cache", function(options) { var grammar = [ '{ var n = 0; }',