Skip to content
Snippets Groups Projects
Commit 033329f1 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Make these tests runnable from sbbs

Don't use chdir(), just use js.exec_dir instead (e.g. for location of test.crt)

Use console instead of stdout when stdout isn't defined.

Log the file and line number of an an exception in a nested test when it
happens.
parent b157afce
No related branches found
No related tags found
No related merge requests found
Pipeline #7831 passed
var f = new File('test.crt');
var f = new File(js.exec_dir + 'test.crt');
f.open('r');
f.readln(65535);
var b64 = f.readln(65535);
......
......@@ -7,23 +7,9 @@
* js.exec()
* writeln()
* write()
* chdir()
*/
var testroot;
if (argc < 1) {
try {
throw barfitty.barf(barf);
}
catch(e) {
testroot = e.fileName;
}
testroot = testroot.replace(/[\/\\][^\/\\]*$/,'');
testroot = backslash(testroot);
}
else
testroot = backslash(argv[0]);
var testroot = js.exec_dir;
var testdirs = {};
function depth_first(root, parent)
......@@ -59,6 +45,9 @@ testdirs[testroot].tests = [];
var passed = 0;
var failed = 0;
if (this.stdout === undefined)
stdout = console;
function run_tests(location, obj)
{
if (testroot.length > location.substr)
......@@ -74,13 +63,11 @@ function run_tests(location, obj)
try {
var dir = testscript;
stdout.write(format("%-70.70s ", testscript.substr(location.length)+'......................................................................'));
chdir(location);
var result = js.exec(testscript, location, new function(){});
chdir(js.exec_dir);
if (result instanceof Error) {
tfailed = true;
fail_msg = result.toString();
log("Caught: "+result);
log(file_getname(result.fileName) + " line " + result.lineNumber + " " + result);
}
}
catch(e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment