2006-08-14 03:47:47 +02:00
|
|
|
load( "build/js/writeFile.js", "build/js/parse.js" );
|
|
|
|
|
|
|
|
var dir = arguments[1];
|
|
|
|
|
|
|
|
var indexFile = readFile( "build/test/index.html" );
|
|
|
|
var testFile = readFile( "build/test/test.html" );
|
|
|
|
|
|
|
|
var jq = parse( readFile( arguments[0] ) );
|
|
|
|
|
2006-08-25 20:38:24 +02:00
|
|
|
var fileList = [];
|
|
|
|
var count = 1;
|
|
|
|
|
2006-08-14 03:47:47 +02:00
|
|
|
for ( var i = 0; i < jq.length; i++ ) {
|
|
|
|
if ( jq[i].tests.length > 0 ) {
|
2006-08-25 20:38:24 +02:00
|
|
|
var name = count + "-" + jq[i].name;
|
2006-09-04 06:51:57 +02:00
|
|
|
if(count < 100) {
|
|
|
|
name = "0" + name;
|
|
|
|
}
|
|
|
|
if(count < 10) {
|
|
|
|
name = "0" + name;
|
|
|
|
}
|
2006-08-14 03:47:47 +02:00
|
|
|
|
|
|
|
var fileName = "tests/" + name + ".js";
|
|
|
|
|
|
|
|
writeFile( dir + "/" + fileName, jq[i].tests.join("\n") );
|
|
|
|
|
2006-08-25 20:38:24 +02:00
|
|
|
fileList.push( fileName );
|
|
|
|
|
|
|
|
count++;
|
2006-08-14 03:47:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var fileString = "";
|
2006-08-25 20:38:24 +02:00
|
|
|
for ( var i = 0; i < fileList.length; i++ ) {
|
2006-08-14 03:47:47 +02:00
|
|
|
if ( fileString ) fileString += ", ";
|
2006-08-25 20:38:24 +02:00
|
|
|
fileString += "'" + fileList[i] + "'";
|
2006-08-14 03:47:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
writeFile( dir + "/index.html", indexFile.replace( /{FILES}/g, fileString ) );
|