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

redux
David Majda 13 years ago
parent e17d4de7ae
commit 171d62fce4

@ -154,6 +154,19 @@ describe("PEG.js grammar parser", function() {
});
});
/* Canonical rule is "a: \"abcd\"". */
it("parses rule", function() {
expect('start = "abcd" / "efgh" / "ijkl"').toParseAs(
oneRuleGrammar(null, choiceOfLiterals)
);
expect('start "start rule" = "abcd" / "efgh" / "ijkl"').toParseAs(
oneRuleGrammar("start rule", choiceOfLiterals)
);
expect('start = "abcd" / "efgh" / "ijkl";').toParseAs(
oneRuleGrammar(null, choiceOfLiterals)
);
});
/* Canonical expression is "\"abcd\" / \"efgh\" / \"ijkl\"". */
it("parses expression", function() {
expect('start = "abcd" / "efgh" / "ijkl"').toParseAs(

@ -199,25 +199,4 @@ test("parses initializer", function() {
parserParses('{ code };a = "abcd"', initializerGrammar);
});
/* Canonical rule is "a: \"abcd\"". */
test("parses rule", function() {
parserParses(
'start = "abcd" / "efgh" / "ijkl"',
oneRuleGrammar(choiceLiterals)
);
parserParses(
'start "start rule" = "abcd" / "efgh" / "ijkl"',
{
type: "grammar",
initializer: null,
rules: [rule("start", "start rule", choiceLiterals)],
startRule: "start"
}
);
parserParses(
'start = "abcd" / "efgh" / "ijkl";',
oneRuleGrammar(choiceLiterals)
);
});
})();

Loading…
Cancel
Save