1 load( "build/js/writeFile.js", "build/js/parse.js" );
3 function addParams(name, params) {
4 if(params.length > 0) {
6 for ( var i = 0; i < params.length; i++) {
7 name += params[i].type + ", ";
9 return name.substring(0, name.length - 2) + ")";
14 function addTestWrapper(name, test) {
15 return 'test("' + name + '", function() {\n' + test + '\n});';
18 var dir = arguments[1];
19 var jq = parse( read(arguments[0]) );
23 String.prototype.decode = function() {
24 return this.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
27 for ( var i = 0; i < jq.length; i++ ) {
28 if ( jq[i].tests.length > 0 ) {
30 var name = addParams(method.name, method.params);
31 for(var j = 0; j < method.tests.length; j++) {
35 testFile[testFile.length] = addTestWrapper(name, method.tests[j].decode()) + "\n";
40 var indexFile = readFile( "build/test/index.html" );
41 writeFile( dir + "/index.html", indexFile.replace( /{TESTS}/g, testFile.join("\n") ) );