From f746189f2b7a0f9bca8f1b1ae37d5c3934a0a676 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sat, 21 Apr 2012 12:47:56 +0200 Subject: [PATCH] Jasmine: Convert tests of parser's "initializer" rule --- spec/parser.spec.js | 11 +++++++++++ test/parser-test.js | 5 ----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/spec/parser.spec.js b/spec/parser.spec.js index bc5530c..8f7f413 100644 --- a/spec/parser.spec.js +++ b/spec/parser.spec.js @@ -157,6 +157,17 @@ describe("PEG.js grammar parser", function() { }); }); + /* Canonical initializer is "{ code }". */ + it("parses initializer", function() { + var grammar = oneRuleGrammar(literalAbcd, { + type: "initializer", + code: " code " + }, null); + + expect('{ code } start = "abcd"' ).toParseAs(grammar); + expect('{ code }; start = "abcd"').toParseAs(grammar); + }); + /* Canonical rule is "a: \"abcd\"". */ it("parses rule", function() { expect('start = "abcd" / "efgh" / "ijkl"').toParseAs( diff --git a/test/parser-test.js b/test/parser-test.js index 22caf12..53391d4 100644 --- a/test/parser-test.js +++ b/test/parser-test.js @@ -193,10 +193,5 @@ test("parses grammar", function() { ); }); -/* Canonical initializer is "{ code }". */ -test("parses initializer", function() { - parserParses('{ code }a = "abcd"', initializerGrammar); - parserParses('{ code };a = "abcd"', initializerGrammar); -}); })();