Permalink
Browse files

get test back running

  • Loading branch information...
1 parent bd7585b commit d98c58c9bcfa5f07ed5d47c6b92a87b8689da13a @dodo dodo committed May 21, 2011
Showing with 34 additions and 1 deletion.
  1. +1 −1 makefile
  2. +33 −0 test/test_all.js
View
2 makefile
@@ -3,5 +3,5 @@ NODE = node
test:
@$(NODE) test/test_all.js
-
+
.PHONY: test
View
33 test/test_all.js
@@ -1,6 +1,34 @@
+require.paths.unshift("./lib", "./spec/lib", "./test");
+
+module.exports = {};
var sys = require('sys');
+// patch
+var async_testing = require('async_testing');
+var TestSuite = async_testing.TestSuite = function (name) {
+ this.name = name;
+ this.obj = {};
+};
+TestSuite.prototype.addTests = function (obj) {
+ this.obj = obj;
+ for(key in obj) {
+ if (!obj.hasOwnProperty(key)) continue;
+ obj[key] = (function(fun) {
+ return function (test) {
+ return fun(test, test.finish);
+ };
+ })(obj[key]);
+ }
+};
+
+TestSuite.prototype.runTests = function (callback) {
+ module.exports[this.name] = function () {
+ async_testing.runSuite(this.obj, {name:this.name, onSuitDone:callback});
+ };
+};
+
+
// Diff tests
require('diff/test_diff').suite.runTests(function() {});
@@ -33,3 +61,8 @@ require('test_submodule').suite.runTests(function() {});
require('test_tag').suite.runTests(function() {});
require('test_tree').suite.runTests(function() {});
+
+if (module == require.main) {
+ return require('async_testing').run(__filename, process.ARGV);
+}
+

0 comments on commit d98c58c

Please sign in to comment.