forked from cory/tildefriends
core
data
deps
packages
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
tools
COPYING
LICENSE
README.md
SConstruct
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3292 ed5197a5-7fde-0310-b194-c3ffbd925b24
29 lines
340 B
Bash
29 lines
340 B
Bash
#!/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
|