Jasmine: Convert any matching tests

redux
David Majda 12 years ago
parent ec48742032
commit 75ab03dc85

@ -137,4 +137,20 @@ describe("generated parser", function() {
});
});
});
describe("any matching", function() {
varyAll(function(options) {
it("matches correctly", function() {
var parser = PEG.buildParser('start = .', options);
expect(parser).toParse("a", "a");
});
it("advances position on success", function() {
var parser = PEG.buildParser('start = . .', options);
expect(parser).toParse("ab", ["a", "b"]);
});
});
});
});

@ -643,20 +643,6 @@ testWithVaryingTrackLineAndColumn("rule references", function(options) {
parses(parser, "Python", "Python");
});
testWithVaryingTrackLineAndColumn("anys", function(options) {
var parser = PEG.buildParser('start = .', options);
parses(parser, "a", "a");
doesNotParse(parser, "");
doesNotParse(parser, "ab");
/*
* Test that the parsing position moves forward after successful parsing of
* an any.
*/
var posTestParser = PEG.buildParser('start = . .', options);
parses(posTestParser, "ab", ["a", "b"]);
});
testWithVaryingTrackLineAndColumn("classes", function(options) {
var emptyClassParser = PEG.buildParser('start = []', options);
doesNotParse(emptyClassParser, "");

Loading…
Cancel
Save