From 95f70c9562dd0ec96b913c6ab328af6a83859d1b Mon Sep 17 00:00:00 2001 From: David Majda Date: Sat, 21 Aug 2010 11:59:42 +0200 Subject: [PATCH] Test the checks directly, do not go through |PEG.buildParser| --- test/checks-test.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/checks-test.js b/test/checks-test.js index 7ff1b9e..5cb78b0 100644 --- a/test/checks-test.js +++ b/test/checks-test.js @@ -20,7 +20,10 @@ test("reports missing referenced rules", function() { for (var i = 0; i < grammars.length; i++) { throws( - function() { PEG.buildParser(grammars[i]); }, + function() { + var ast = PEG.parser.parse(grammars[i]); + PEG.compiler.checks.missingReferencedRules(ast); + }, PEG.GrammarError, { message: "Referenced rule \"missing\" does not exist." } ); @@ -48,7 +51,10 @@ test("reports left recursion", function() { for (var i = 0; i < grammars.length; i++) { throws( - function() { PEG.buildParser(grammars[i]); }, + function() { + var ast = PEG.parser.parse(grammars[i]); + PEG.compiler.checks.leftRecursion(ast); + }, PEG.GrammarError, { message: "Left recursion detected for rule \"start\"." } );