You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB
JavaScript

parses = function(parser, input, expected) {
deepEqual(parser.parse(input), expected);
};
parsesWithStartRule = function(parser, input, startRule, expected) {
deepEqual(parser.parse(input, startRule), expected);
};
doesNotParse = function(parser, input) {
raises(function() { parser.parse(input); }, parser.SyntaxError);
};
doesNotParseWithMessage = function(parser, input, message) {
raises(
function() { parser.parse(input); },
function(e) {
return e instanceof parser.SyntaxError && e.message === message;
}
);
};
doesNotParseWithPos = function(parser, input, line, column) {
raises(
function() { parser.parse(input); },
function(e) {
return e instanceof parser.SyntaxError
&& e.line === line
&& e.column === column;
}
);
};
parserParses = function(input, expected) {
parses(PEG.parser, input, expected);
};
parserDoesNotParse = function(input) {
doesNotParse(PEG.parser, input);
};
parserDoesNotParseWithMessage = function(input, message) {
doesNotParseWithMessage(PEG.parser, input, message);
};