cleanup: More unused files

This commit is contained in:
Jeremy Wall 2024-04-02 19:46:45 -04:00
parent 7e18862cdd
commit 726dd2778f
5 changed files with 0 additions and 296 deletions

View File

@ -1,104 +0,0 @@
if (typeof Test == 'undefined') {
Test = {};
}
if (typeof Test.TAP == 'undefined') {
if (typeof JSAN != 'undefined') {
JSAN.use('Test.TAP');
} else {
throw new Error('Test.TAP.Runner is dependent on Test.TAP');
}
}
/*
=head1 NAME
Test.TAP.Runner - A Simple Test Harness for Test.TAP
=head1 Synopsis
var r = new Test.TAP.Runner().
var testobj = {};
testobj.runtests = function() {
var t = new Test.TAP();
t.plan(2);
t.ok(true, 'true is true');
t.is(1, 1, 'one is one');
return t;
}
r.run_tests(obj);
=cut
*/
Test.TAP.Runner = function() {};
Test.TAP.Runner.prototype = new Test();
/*
=head1 Methods
=head2 out()
internal method inherited from L<Test.TAP> see L<Test.TAP> for useage
=cut
=head2 diag()
internal method inherited from L<Test.TAP> see L<Test.TAP> for useage
=cut
=head2 run_it()
runs the tests in a test object and reports on the results
=cut
*/
Test.TAP.Runner.prototype.run_it = function(obj) {
this.diag('running ' + obj.name + ' tests');
var tester;
try {
tester = obj.runtests();
if (tester.planned > tester.counter) {
tester.diag('looks like you planned ' + tester.planned + ' tests but only ran '
+ tester.counter + ' tests');
} else if (tester.planned < tester.counter) {
tester.diag('looks like you planned ' + tester.planned + ' tests but ran '
+ (tester.counter - tester.planned) + ' tests extra');
}
this.diag('ran ' + tester.counter + ' tests out of ' + tester.planned);
this.diag('passed ' + tester.passed + ' tests out of ' + tester.planned)
this.diag('failed ' + tester.failed + ' tests out of ' + tester.planned)
}
catch(err) {
this.diag("Test Suite Crashed!!! (" + err + ")");
}
return tester;
};
/*
=head2 run_tests()
r.run_tests(obj1, obj2);
runs the tests in a list of test objects and reports on the results
=cut
*/
Test.TAP.Runner.prototype.run_tests = function() {
var all = [];
for (i=0; i<arguments.length; i++) {
all.push(this.run_it(arguments[i]));
this.out('\n');
}
return all;
};

View File

@ -1,103 +0,0 @@
function load(path) {
var url = location.pathname + "#" + encodeURIComponent(path.replace(/^\.\//, ''))
Test.TAP.prototype.diag('loading: '+path+' <a href="'+url+'">(run in a single window)</a>...');
var req = new XMLHttpRequest();
req.open("GET", path, false);
req.send(null);
if (req.readyState == 4) {
var testobj = eval(req.responseText);
return testobj;
}
}
function createScriptTag(library) {
var path = library.replace(/\./g, '/')+'.js';
var script = document.createElement("script");
script.src = lib+'/'+path;
return script;
}
function loadlib(library) {
document.body.appendChild(createScriptTag(library));
}
function loadTest(test) {
var path = testlib+'/'+test;
return load(path);
}
function loadComponents() {
for (c in toLoad) {
var comp = toLoad[c];
loadlib(comp);
}
}
function runtest(t) {
var outtxt = "";
var div = document.createElement("div");
var onclick = function () {
var c = div.className;
if (c.match(/big/)) {
c = c.replace(/big/, "small");
} else if (c.match(/small/)) {
c = c.replace(/small/, "big");
}
div.className = c;
};
div.addEventListener('click', onclick, true);
div.className = 'test small';
document.body.appendChild(div);
var outfunc = function(text) {
if (text) {
outtxt += text;
if (text.match(/(not ok|Test Suite Crashed)/g) ) {
div.innerHTML = "<div class='fail'>" + div.innerHTML + "\n" + text + "</div>"
} else {
div.innerHTML = "<div class='pass'>" + div.innerHTML + "\n" + text + "</div>"
}
}
}
// set globally for synchronous run
Test.TAP.prototype.out = outfunc;
var testobj = loadTest(t);
if (!testobj) {
alert ("Test Object: "+t+" did not load");
throw new ReferenceError("Test Object did now load");
}
// also set to instance for asynchronous output
testobj.out = outfunc
testobj.on_finished = function () {
if (outtxt.match(/(not ok|Test Suite Crashed)/g) ) {
div.className += ' failsuite';
div.className.replace(/small/, 'big');
}
results.push(div);
}
setTimeout(function () {
testobj.run_tests()
}, 0)
}
var test = loc.match(/.+[#?](.*)\??.*/);
loadComponents();
window.onload = function() {
var testlist = [];
if (test) {
runtest(test[1]);
} else {
for (t in tests) {
runtest(tests[t]);
}
}
}

View File

@ -1,51 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="../ext/Test/TAP.js"></script>
<script type="text/javascript" src="../ext/Test/TAP/Class.js"></script>
</head>
<body>
<style type="text/css">
.test {
margin-top : 10px;
margin-bottom : 10px;
border : 3px;
border-style : inset;
overflow : auto;
}
.small {
height : 20px;
}
.big {
height : 600px;
}
.fail { background-color : red; }
.pass { background-color : green; }
.failsuite {border: 3px solid red;}
</style>
<!--Test Description here -->
<script type="text/javascript">
var top = this;
/** Configuration options
*
*/
var tests = [
'<list test files here>',
];
// Change this to the path of your test scripts
var testlib = '.';
/** Setup
*
*/
var loc = String(top.location);
var results = [];
</script>
<script type="text/javascript" src="../ext/Test/TAPBrowser.js"></script>
</body>
</html>

View File

@ -1,3 +0,0 @@
#!/bin/bash
rhino harness/rhino_harness.js

View File

@ -1,35 +0,0 @@
var libpath = 'lib';
var extpath = 'ext';
var testpath = 't';
var extlibs = [
'Test/TAP.js',
'Test/TAP/Class.js',
'Test/TAP/Runner.js',
'joose.js'
];
var libs = [
'<list external libs here>'
];
var tests = [
'<list test files here>',
];
for (i in extlibs) {
var lib = extlibs[i];
load(extpath+'/'+lib);
}
for (i in libs) {
var lib = libs[i];
load(libpath+'/'+lib);
}
for (i in tests) {
var test = tests[i];
var script = readFile(testpath+'/'+test);
t = eval(script);
t.run_tests();
}