Jasmine: Convert tests of parser's "primary" rule

redux
David Majda 13 years ago
parent 57bbcd71e5
commit 45f825c24f

@ -134,6 +134,15 @@ describe("PEG.js grammar parser", function() {
});
});
/* Canonical primary is "\"abcd\"". */
it("parses primary", function() {
expect('start = a' ).toParseAs(ruleRefGrammar("a"));
expect('start = "abcd"' ).toParseAs(literalGrammar("abcd"));
expect('start = .' ).toParseAs(oneRuleGrammar(null, { type: "any" }));
expect('start = [a-d]' ).toParseAs(classGrammar([["a", "d"]], "[a-d]"));
expect('start = ("abcd")').toParseAs(literalGrammar("abcd"));
});
/* Canonical action is "{ code }". */
it("parses action", function() {
expect('start = "abcd" { code }').toParseAs(actionGrammar(" code "));

@ -293,13 +293,4 @@ test("parses suffixed", function() {
parserParses('start = "abcd"', literalGrammar("abcd"));
});
/* Canonical primary is "\"abcd\"". */
test("parses primary", function() {
parserParses('start = a', identifierGrammar("a"));
parserParses('start = "abcd"', literalGrammar("abcd"));
parserParses('start = .', anyGrammar);
parserParses('start = [a-d]', classGrammar(false, [["a", "d"]], "[a-d]"));
parserParses('start = ("abcd")', literalGrammar("abcd"));
});
})();

Loading…
Cancel
Save