Files
apps
core
deps
docs
src
tests
01-nop
02-valgrind
03-child
04-promise
05-promise-remote-throw
07-promise-remote-reject
08-database
09-this
10-await
11-require
12-exit
13-icu
14-uint8array
15-socket
tools
COPYING
LICENSE
Makefile
README.md
tildefriends/tests/11-require

29 lines
340 B
Plaintext
Raw Normal View History

#!/bin/bash
cat > required.js << EOF
function foo() {
return 12345;
}
exports.foo = foo;
EOF
cat > test.js << EOF
if (require("required").foo() != 12345) {
exit(1);
}
var gotError = false;
try {
require("missing");
} catch (error) {
print("nope");
gotError = true;
}
if (!gotError) {
exit(2);
}
exit(0);
EOF
$TILDEFRIENDS test.js