Jasmine: Convert simple and matching tests

redux
David Majda 12 years ago
parent 343e9db525
commit b013ba8cc9

@ -91,6 +91,23 @@ describe("generated parser", function() {
});
});
describe("simple and matching", function() {
varyAll(function(options) {
it("matches correctly", function() {
var parser = PEG.buildParser('start = &"a" "a"', options);
expect(parser).toParse("a", ["", "a"]);
expect(parser).toFailToParse("b");
});
it("does not advance position on success", function() {
var parser = PEG.buildParser('start = &"a" "a"', options);
expect(parser).toParse("a", ["", "a"]);
});
});
});
describe("simple not matching", function() {
varyAll(function(options) {
it("matches correctly", function() {

@ -49,17 +49,6 @@ testWithVaryingTrackLineAndColumn("labels", function(options) {
doesNotParse(parser, "b");
});
testWithVaryingTrackLineAndColumn("simple and", function(options) {
var parser = PEG.buildParser('start = "a" &"b" "b"', options);
parses(parser, "ab", ["a", "", "b"]);
doesNotParse(parser, "ac");
/*
* Test that the parsing position returns after successful parsing of a
* predicate is not needed, it is implicit in the tests above.
*/
});
testWithVaryingTrackLineAndColumn("initializer", function(options) {
var variableInActionParser = PEG.buildParser(
'{ a = 42; }; start = "a" { return a; }',

Loading…
Cancel
Save