diff --git a/spec/parser.spec.js b/spec/parser.spec.js index 2300e34..aefaa46 100644 --- a/spec/parser.spec.js +++ b/spec/parser.spec.js @@ -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( diff --git a/test/parser-test.js b/test/parser-test.js index 68c225c..d47255c 100644 --- a/test/parser-test.js +++ b/test/parser-test.js @@ -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) - ); -}); - })();