forked from cory/tildefriends
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
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3621 ed5197a5-7fde-0310-b194-c3ffbd925b24
32 lines
598 B
Bash
Executable File
32 lines
598 B
Bash
Executable File
#!/bin/bash
|
|
|
|
cat > test.js << EOF
|
|
var task = new Task();
|
|
task.activate();
|
|
task.execute({name: "child.js", source: utf8Decode(File.readFile("child.js"))}).then(function() {
|
|
task.getExports().then(function(exp) {
|
|
return exp.add(1, 1);
|
|
}).then(function(sum) {
|
|
exit(1);
|
|
}).catch(function(error) {
|
|
print("Caught: " + error.message);
|
|
if (error.stack) {
|
|
print("stack: " + error.stack);
|
|
}
|
|
exit(0);
|
|
});
|
|
}).catch(function(e) {
|
|
print("caught", e.message);
|
|
});
|
|
EOF
|
|
|
|
cat > child.js << EOF
|
|
exports = {
|
|
add: function(left, right) {
|
|
throw new Error("fail");
|
|
}
|
|
};
|
|
EOF
|
|
|
|
$TILDEFRIENDS test.js
|