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

redux
David Majda 12 years ago
parent cc22086a09
commit e17d4de7ae

@ -16,6 +16,10 @@ describe("PEG.js grammar parser", function() {
sequenceOfLabeleds = {
type: "sequence",
elements: [labeledAbcd, labeledEfgh, labeledIjkl]
},
choiceOfLiterals = {
type: "choice",
alternatives: [literalAbcd, literalEfgh, literalIjkl]
};
function oneRuleGrammar(displayName, expression) {
@ -150,6 +154,13 @@ describe("PEG.js grammar parser", function() {
});
});
/* Canonical expression is "\"abcd\" / \"efgh\" / \"ijkl\"". */
it("parses expression", function() {
expect('start = "abcd" / "efgh" / "ijkl"').toParseAs(
oneRuleGrammar(null, choiceOfLiterals)
);
});
/* Canonical choice is "\"abcd\" / \"efgh\" / \"ijkl\"". */
it("parses choice", function() {
expect('start = "abcd" "efgh" "ijkl"').toParseAs(

@ -220,12 +220,4 @@ test("parses rule", function() {
);
});
/* Canonical expression is "\"abcd\" / \"efgh\" / \"ijkl\"". */
test("parses expression", function() {
parserParses(
'start = "abcd" / "efgh" / "ijkl"',
oneRuleGrammar(choiceLiterals)
);
});
})();

Loading…
Cancel
Save