Jasmine: Convert optional matching tests

redux
David Majda 13 years ago
parent 669668fc1b
commit ccf31f8822

@ -91,6 +91,17 @@ describe("generated parser", function() {
}); });
}); });
describe("optional matching", function() {
varyAll(function(options) {
it("matches correctly", function() {
var parser = PEG.buildParser('start = "a"?', options);
expect(parser).toParse("", "");
expect(parser).toParse("a", "a");
});
});
});
describe("zero or more matching", function() { describe("zero or more matching", function() {
varyAll(function(options) { varyAll(function(options) {
it("matches correctly", function() { it("matches correctly", function() {

@ -429,12 +429,6 @@ test("semantic not (with trackLineAndColumn: true)", function() {
parses(digitsParser, "1\u2029x", [2, 1]); // paragraph separator parses(digitsParser, "1\u2029x", [2, 1]); // paragraph separator
}); });
testWithVaryingTrackLineAndColumn("optional expressions", function(options) {
var parser = PEG.buildParser('start = "a"?', options);
parses(parser, "", "");
parses(parser, "a", "a");
});
testWithVaryingTrackLineAndColumn("initializer", function(options) { testWithVaryingTrackLineAndColumn("initializer", function(options) {
var variableInActionParser = PEG.buildParser( var variableInActionParser = PEG.buildParser(
'{ a = 42; }; start = "a" { return a; }', '{ a = 42; }; start = "a" { return a; }',

Loading…
Cancel
Save