[Pkg-javascript-commits] [node-acorn-jsx] 309/484: Make test runner more generic.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit d745bd7e32a60734939c01e17aa40a6b89121af6
Author: Ingvar Stepanyan <me at rreverser.com>
Date: Sun Oct 26 17:29:51 2014 +0200
Make test runner more generic.
---
test/driver.js | 5 ++---
test/run.js | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/driver.js b/test/driver.js
index a08bf6e..f948fe6 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 2d44344..7e84a79 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) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list