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

redux
David Majda 12 years ago
parent 3e083cc51b
commit bf6d412a4f

@ -135,6 +135,27 @@ describe("PEG.js grammar parser", function() {
});
});
/* Canonical prefixed is "!\"abcd\"". */
it("parses prefixed", function() {
expect('start = &{ code }').toParseAs(oneRuleGrammar(null, {
type: "semantic_and",
code: " code "
}));
expect('start = &"abcd"?' ).toParseAs(oneRuleGrammar(null, {
type: "simple_and",
expression: optionalLiteral
}));
expect('start = !{ code }').toParseAs(oneRuleGrammar(null, {
type: "semantic_not",
code: " code "
}));
expect('start = !"abcd"?' ).toParseAs(oneRuleGrammar(null, {
type: "simple_not",
expression: optionalLiteral
}));
expect('start = "abcd"?' ).toParseAs(oneRuleGrammar(null, optionalLiteral));
});
/* Canonical suffixed is "\"abcd\"?". */
it("parses suffixed", function() {
expect('start = "abcd"?').toParseAs(oneRuleGrammar(null, optionalLiteral));

@ -276,13 +276,4 @@ test("parses labeled", function() {
parserParses('start = !"abcd"', oneRuleGrammar(simpleNot(literalAbcd)));
});
/* Canonical prefixed is "!\"abcd\"". */
test("parses prefixed", function() {
parserParses('start = &{ code }', oneRuleGrammar(semanticAnd(" code ")));
parserParses('start = &"abcd"?', oneRuleGrammar(simpleAnd(optionalLiteral)));
parserParses('start = !{ code }', oneRuleGrammar(semanticNot(" code ")));
parserParses('start = !"abcd"?', oneRuleGrammar(simpleNot(optionalLiteral)));
parserParses('start = "abcd"?', oneRuleGrammar(optionalLiteral));
});
})();

Loading…
Cancel
Save