From 726dd2778f10a31d4aeeba694051976a96c8ea6d Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Tue, 2 Apr 2024 19:46:45 -0400 Subject: [PATCH] cleanup: More unused files --- src/Runner.js | 104 ------------------------------------------ src/TAPBrowser.js | 103 ----------------------------------------- tmpl/TapHarness.html | 51 --------------------- tmpl/prove_rhino.t | 3 -- tmpl/rhino_harness.js | 35 -------------- 5 files changed, 296 deletions(-) delete mode 100644 src/Runner.js delete mode 100644 src/TAPBrowser.js delete mode 100644 tmpl/TapHarness.html delete mode 100644 tmpl/prove_rhino.t delete mode 100755 tmpl/rhino_harness.js diff --git a/src/Runner.js b/src/Runner.js deleted file mode 100644 index 5a1aa28..0000000 --- a/src/Runner.js +++ /dev/null @@ -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 see L for useage - -=cut - -=head2 diag() - -internal method inherited from L see L 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(run in a single window)...'); - 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.innerHTML + "\n" + text + "
" - } else { - div.innerHTML = "
" + div.innerHTML + "\n" + text + "
" - } - - } - } - - // 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]); - } - } -} diff --git a/tmpl/TapHarness.html b/tmpl/TapHarness.html deleted file mode 100644 index 26f9cff..0000000 --- a/tmpl/TapHarness.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/tmpl/prove_rhino.t b/tmpl/prove_rhino.t deleted file mode 100644 index cf881a7..0000000 --- a/tmpl/prove_rhino.t +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -rhino harness/rhino_harness.js diff --git a/tmpl/rhino_harness.js b/tmpl/rhino_harness.js deleted file mode 100755 index 1c9468f..0000000 --- a/tmpl/rhino_harness.js +++ /dev/null @@ -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 = [ - '' - ]; - -var tests = [ - '', - ]; - -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(); -}