| 1 | /* global peg */ |
| 2 | |
| 3 | "use strict"; |
| 4 | |
| 5 | describe("compiler pass |reportDuplicateRules|", function() { |
| 6 | var pass = peg.compiler.passes.check.reportDuplicateRules; |
| 7 | |
| 8 | it("reports duplicate rules", function() { |
| 9 | expect(pass).toReportError([ |
| 10 | 'start = "a"', |
| 11 | 'start = "b"' |
| 12 | ].join('\n'), { |
| 13 | message: 'Rule "start" is already defined at line 1, column 1.', |
| 14 | location: { |
| 15 | start: { offset: 12, line: 2, column: 1 }, |
| 16 | end: { offset: 23, line: 2, column: 12 } |
| 17 | } |
| 18 | }); |
| 19 | }); |
| 20 | }); |