Fix string parsing tests

The tests were wrong because the |string| rule is not used to parse
literals but rule names.
redux
David Majda 13 years ago
parent 3421bdb813
commit 9c3da347cc

@ -161,6 +161,13 @@ var initializerGrammar = {
startRule: "a"
};
var namedRuleGrammar = {
type: "grammar",
initializer: null,
rules: { start: rule("start", "abcd", literalAbcd) },
startRule: "start"
};
/* Canonical grammar is "a: \"abcd\"; b: \"efgh\"; c: \"ijkl\";". */
test("parses grammar", function() {
parserParses(
@ -344,10 +351,10 @@ test("parses literal", function() {
/* Canonical string is "\"abcd\"". */
test("parses string", function() {
parserParses('start = "abcd"', literalGrammar("abcd"));
parserParses("start = 'abcd'", literalGrammar("abcd"));
parserParses('start "abcd" = "abcd"', namedRuleGrammar);
parserParses('start \'abcd\' = "abcd"', namedRuleGrammar);
parserParses('start = "abcd"\n', literalGrammar("abcd"));
parserParses('start "abcd"\n= "abcd"', namedRuleGrammar);
});
/* Canonical doubleQuotedString is "\"abcd\"". */

Loading…
Cancel
Save