Jasmine: Convert choice matching tests
This commit is contained in:
parent
1b0789fbae
commit
f5f40f68d2
|
@ -91,6 +91,19 @@ describe("generated parser", function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe("choice matching", function() {
|
||||
varyAll(function(options) {
|
||||
it("matches correctly", function() {
|
||||
var parser = PEG.buildParser('start = "a" / "b" / "c"', options);
|
||||
|
||||
expect(parser).toParse("a", "a");
|
||||
expect(parser).toParse("b", "b");
|
||||
expect(parser).toParse("c", "c");
|
||||
expect(parser).toFailToParse("d");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("sequence matching", function() {
|
||||
varyAll(function(options) {
|
||||
it("matches empty sequence correctly", function() {
|
||||
|
|
|
@ -13,16 +13,6 @@ function testWithVaryingTrackLineAndColumn(name, callback) {
|
|||
);
|
||||
}
|
||||
|
||||
testWithVaryingTrackLineAndColumn("choices", function(options) {
|
||||
var parser = PEG.buildParser('start = "a" / "b" / "c"', options);
|
||||
parses(parser, "a", "a");
|
||||
parses(parser, "b", "b");
|
||||
parses(parser, "c", "c");
|
||||
doesNotParse(parser, "");
|
||||
doesNotParse(parser, "ab");
|
||||
doesNotParse(parser, "d");
|
||||
});
|
||||
|
||||
testWithVaryingTrackLineAndColumn("initializer", function(options) {
|
||||
var variableInActionParser = PEG.buildParser(
|
||||
'{ a = 42; }; start = "a" { return a; }',
|
||||
|
|
Loading…
Reference in a new issue