|
|
|
@ -53,17 +53,21 @@ describe("generated parser API", function() {
|
|
|
|
|
].join("\n"), { trace: true });
|
|
|
|
|
|
|
|
|
|
describe("default tracer", function() {
|
|
|
|
|
it("traces using console.log", function() {
|
|
|
|
|
spyOn(console, "log");
|
|
|
|
|
it("traces using console.log (if console is defined)", function() {
|
|
|
|
|
if (typeof console === "object") {
|
|
|
|
|
spyOn(console, "log");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parser.parse("b");
|
|
|
|
|
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.enter start");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.enter a");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.fail a");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.enter b");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:2 rule.match b");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:2 rule.match start");
|
|
|
|
|
if (typeof console === "object") {
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.enter start");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.enter a");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.fail a");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:1 rule.enter b");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:2 rule.match b");
|
|
|
|
|
expect(console.log).toHaveBeenCalledWith("1:1-1:2 rule.match start");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|