Starting to move the tests to C.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3652 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-08-19 19:29:37 +00:00
parent be6a39bd15
commit dd90fe4fbf
9 changed files with 154 additions and 102 deletions

View File

@ -1,8 +0,0 @@
#!/bin/bash
cat > test.js << EOF
print("hi");
EOF
echo $TILDEFRIENDS test.js
$TILDEFRIENDS test.js

View File

@ -1,15 +0,0 @@
#!/bin/bash
echo "SKIP"
exit 0
if [ ! -x /usr/bin/valgrind ]; then
echo "SKIP"
exit 0
fi
cat > test.js << EOF
print("hi");
EOF
valgrind --log-file=$LOGDIR/valgrind.log $TILDEFRIENDS test.js

View File

@ -1,19 +0,0 @@
#!/bin/bash
cat > test.js << EOF
var task = new Task();
task.onExit = function() {
print("child exited");
};
task.activate();
task.execute({name: "child.js", source: utf8Decode(File.readFile("child.js"))}).then(function() {
print("child started");
});
EOF
cat > child.js << EOF
print("I am the child process.");
exit(0);
EOF
$TILDEFRIENDS test.js

View File

@ -1,27 +0,0 @@
#!/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(exports) {
return exports.add(1, 1);
}).then(function(sum) {
if (sum == 2) {
exit(0);
} else {
exit(1);
}
});
});
EOF
cat > child.js << EOF
exports = {
add: function(left, right) {
return left + right;
}
}
EOF
$TILDEFRIENDS test.js

View File

@ -1,31 +0,0 @@
#!/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