From 2f5f8d59324cc18baee53ca36ca6a299a5cde9c4 Mon Sep 17 00:00:00 2001 From: David Majda Date: Fri, 20 Apr 2012 18:59:59 +0200 Subject: [PATCH] Jasmine: Convert tests of parser's "simpleDoubleQuotedCharacter" rule --- spec/parser.spec.js | 9 +++++++++ test/parser-test.js | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/spec/parser.spec.js b/spec/parser.spec.js index a00534e..265d53a 100644 --- a/spec/parser.spec.js +++ b/spec/parser.spec.js @@ -115,6 +115,15 @@ describe("PEG.js grammar parser", function() { }); }); + /* Canonical simpleDoubleQuotedCharacter is "a". */ + it("parses simpleDoubleQuotedCharacter", function() { + expect('start = "a"').toParseAs(literalGrammar("a")); + + expect('start = """' ).toFailToParse(); + expect('start = "\\"').toFailToParse(); + expect('start = "\n"').toFailToParse(); + }); + /* Canonical singleQuotedString is "'abcd'". */ it("parses singleQuotedString", function() { expect("start = ''" ).toParseAs(literalGrammar("")); diff --git a/test/parser-test.js b/test/parser-test.js index 0867a2b..a893b50 100644 --- a/test/parser-test.js +++ b/test/parser-test.js @@ -372,16 +372,4 @@ test("parses doubleQuotedCharacter", function() { parserParses('start = "\\\n"', literalGrammar("\n")); }); -/* Canonical simpleDoubleQuotedCharacter is "a". */ -test("parses simpleDoubleQuotedCharacter", function() { - parserParses('start = "a"', literalGrammar("a")); - parserParses('start = "\'"', literalGrammar("'")); - parserDoesNotParse('start = """'); - parserDoesNotParse('start = "\\"'); - parserDoesNotParse('start = "\n"'); - parserDoesNotParse('start = "\r"'); - parserDoesNotParse('start = "\u2028"'); - parserDoesNotParse('start = "\u2029"'); -}); - })();