diff --git a/test/checks-test.js b/test/checks-test.js
new file mode 100644
index 0000000..7ff1b9e
--- /dev/null
+++ b/test/checks-test.js
@@ -0,0 +1,58 @@
+(function(global) {
+
+module("PEG.compiler.checks");
+
+test("reports missing referenced rules", function() {
+ var grammars = [
+ 'start = missing',
+ 'start = missing / "a" / "b"',
+ 'start = "a" / "b" / missing',
+ 'start = missing "a" "b"',
+ 'start = "a" "b" missing',
+ 'start = label:missing',
+ 'start = &missing',
+ 'start = !missing',
+ 'start = missing?',
+ 'start = missing*',
+ 'start = missing+',
+ 'start = missing { }'
+ ];
+
+ for (var i = 0; i < grammars.length; i++) {
+ throws(
+ function() { PEG.buildParser(grammars[i]); },
+ PEG.GrammarError,
+ { message: "Referenced rule \"missing\" does not exist." }
+ );
+ }
+});
+
+test("reports left recursion", function() {
+ var grammars = [
+ /* Direct */
+ 'start = start',
+ 'start = start / "a" / "b"',
+ 'start = "a" / "b" / start',
+ 'start = start "a" "b"',
+ 'start = label:start',
+ 'start = &start',
+ 'start = !start',
+ 'start = start?',
+ 'start = start*',
+ 'start = start+',
+ 'start = start { }',
+
+ /* Indirect */
+ 'start = stop; stop = start'
+ ];
+
+ for (var i = 0; i < grammars.length; i++) {
+ throws(
+ function() { PEG.buildParser(grammars[i]); },
+ PEG.GrammarError,
+ { message: "Left recursion detected for rule \"start\"." }
+ );
+ }
+});
+
+})(this);
diff --git a/test/compiler-test.js b/test/compiler-test.js
index dbf92ad..fbb9c2e 100644
--- a/test/compiler-test.js
+++ b/test/compiler-test.js
@@ -66,59 +66,6 @@ test("buildParser reports syntax errors in the grammar", function() {
);
});
-test("buildParser reports missing referenced rules", function() {
- var grammars = [
- 'start = missing',
- 'start = missing / "a" / "b"',
- 'start = "a" / "b" / missing',
- 'start = missing "a" "b"',
- 'start = "a" "b" missing',
- 'start = label:missing',
- 'start = &missing',
- 'start = !missing',
- 'start = missing?',
- 'start = missing*',
- 'start = missing+',
- 'start = missing { }'
- ];
-
- for (var i = 0; i < grammars.length; i++) {
- throws(
- function() { PEG.buildParser(grammars[i]); },
- PEG.GrammarError,
- { message: "Referenced rule \"missing\" does not exist." }
- );
- }
-});
-
-test("buildParser reports left recursion", function() {
- var grammars = [
- /* Direct */
- 'start = start',
- 'start = start / "a" / "b"',
- 'start = "a" / "b" / start',
- 'start = start "a" "b"',
- 'start = label:start',
- 'start = &start',
- 'start = !start',
- 'start = start?',
- 'start = start*',
- 'start = start+',
- 'start = start { }',
-
- /* Indirect */
- 'start = stop; stop = start'
- ];
-
- for (var i = 0; i < grammars.length; i++) {
- throws(
- function() { PEG.buildParser(grammars[i]); },
- PEG.GrammarError,
- { message: "Left recursion detected for rule \"start\"." }
- );
- }
-});
-
test("buildParser allows custom start rule", function() {
var parser = PEG.buildParser('s = "abcd"', "s");
parses(parser, "abcd", "abcd");
diff --git a/test/index.html b/test/index.html
index 78748a1..1271ea5 100644
--- a/test/index.html
+++ b/test/index.html
@@ -7,6 +7,7 @@
+