Jasmine: Convert simple not matching tests

redux
David Majda 12 years ago
parent 2bb25efa44
commit 343e9db525

@ -91,6 +91,23 @@ describe("generated parser", function() {
});
});
describe("simple not matching", function() {
varyAll(function(options) {
it("matches correctly", function() {
var parser = PEG.buildParser('start = !"a" "b"', options);
expect(parser).toParse("b", ["", "b"]);
expect(parser).toFailToParse("a");
});
it("does not advance position on failure", function() {
var parser = PEG.buildParser('start = !"a" / "a"', options);
expect(parser).toParse("a", "a");
});
});
});
describe("semantic and code", function() {
varyAll(function(options) {
it("causes successful match by returning |true|", function() {

@ -60,19 +60,6 @@ testWithVaryingTrackLineAndColumn("simple and", function(options) {
*/
});
testWithVaryingTrackLineAndColumn("simple not", function(options) {
var parser = PEG.buildParser('start = "a" !"b"', options);
parses(parser, "a", ["a", ""]);
doesNotParse(parser, "ab");
/*
* Test that the parsing position returns after successful parsing of a
* predicate.
*/
var posTestParser = PEG.buildParser('start = "a" !"b" "c"');
parses(posTestParser, "ac", ["a", "", "c"]);
});
testWithVaryingTrackLineAndColumn("initializer", function(options) {
var variableInActionParser = PEG.buildParser(
'{ a = 42; }; start = "a" { return a; }',

Loading…
Cancel
Save