diff --git a/test/driver.js b/test/driver.js index a08bf6e837..f948fe656a 100644 --- a/test/driver.js +++ b/test/driver.js @@ -1,6 +1,5 @@ (function(exports) { var tests = []; - var acorn = typeof require == "undefined" ? window.acorn : require("../acorn.js"); exports.test = function(code, ast, options, comments) { tests.push({code: code, ast: ast, options: options, comments: comments}); @@ -12,7 +11,7 @@ tests.push({code: code, assert: assert, options: options}); }; - exports.runTests = function(callback) { + exports.runTests = function(parse, callback) { var comments; function onComment(block, text, start, end, startLoc, endLoc) { @@ -33,7 +32,7 @@ try { comments = []; if (test.options && !test.options.onComment) test.options.onComment = onComment; - var ast = acorn.parse(test.code, test.options || opts); + var ast = parse(test.code, test.options || opts); if (test.error) callback("fail", test.code, "Expected error message: " + test.error + "\nBut parsing succeeded."); else if (test.assert) { diff --git a/test/run.js b/test/run.js index 2d44344745..7e84a79464 100644 --- a/test/run.js +++ b/test/run.js @@ -9,7 +9,8 @@ function report(state, code, message) { } var t0 = +new Date; -driver.runTests(report); +var acorn = typeof require == "undefined" ? window.acorn : require("../acorn.js"); +driver.runTests(acorn.parse, report); console.log(testsRun + " tests run in " + (+new Date - t0) + "ms"); if (failed) {