Sha256: e97ec900546648c23724def93ee966653594937e1829afcbe461bba61e854da1

Contents?: true

Size: 833 Bytes

Versions: 7

Compression:

Stored size: 833 Bytes

Contents

/*
---
name: SG-TestRunner
author: Thomas Aylott
license: MIT Style
...
*/

if (typeof print == 'undefined') var print = require('sys').print;

var assert = require('assert');

exports.run = run;

function run(tests){
	var fails = 0;
	var passed = 0;
	var errors = 0;
	var ran = 0;
	
	for (var name in tests){
		if (!tests.hasOwnProperty(name)) continue;
		if (!/^test/.test(name)) continue;
		if (typeof tests[name] == 'function'){
			print('\t\t+ '+name +'\n');
			try {
				++ ran;
				tests[name](assert);
				++ passed;
			} catch(e){
				print('\t\t\tError: '+ e +'\n');
				++ errors;
			}
		} else {
			print('\t+ '+name +'\n');
			fails += run(tests[name]);
		}
	}
	
	if (ran){
		print("Passed " + passed)
		print("; ")
		print("Failed " + fails)
		print("; ")
		print("Error " + errors)
		print("\n\n")
	}
	return fails;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/Sheet.js/Test/lib/sg-testrunner.js
lsd_rails-0.1.5 Packages/Sheet.js/Test/lib/sg-testrunner.js
lsd_rails-0.1.4 Packages/Sheet.js/Test/lib/sg-testrunner.js
lsd_rails-0.1.3 Packages/Sheet.js/Test/lib/sg-testrunner.js
lsd_rails-0.1.2 Packages/Sheet.js/Test/lib/sg-testrunner.js
lsd_rails-0.1.1 Packages/Sheet.js/Test/lib/sg-testrunner.js
lsd_rails-0.1 Packages/Sheet.js/Test/lib/sg-testrunner.js