Add some test runners.
This commit is contained in:
parent
b9ecf75f17
commit
2efe63ebb2
5 changed files with 109 additions and 0 deletions
30
Examples/test-suite/javascript/callback_runme.js
Normal file
30
Examples/test-suite/javascript/callback_runme.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
var callback = require("./callback");
|
||||
|
||||
if (callback.foo(2) !== 2) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
if (callback.A_bar(2) !== 4) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
if (callback.foobar(3, callback.foo) != callback.foo(3)) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
if (callback.foobar(3, foo) != callback.foo(3)) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
if (callback.foobar(3, callback.A_bar) != callback.A_bar(3)) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
if (callback.foobar(3, callback.foof) != callback.foof(3)) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
if (callback.foobar_i(3, callback.foo_i) != callback.foo_i(3)) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
if (callback.foobar_d(3.5, callback.foo_d) != callback.foo_d(3.5)) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
var a = new callback.A();
|
||||
if (callback.foobarm(3, a, callback.A.foom_cb_ptr) != a.foom(3)) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
22
Examples/test-suite/javascript/disown_runme.js
Normal file
22
Examples/test-suite/javascript/disown_runme.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
var disown = require("./disown");
|
||||
|
||||
var a = new disown.A();
|
||||
var tmp = a.thisown;
|
||||
a.thisown = 0
|
||||
if (a.thisown) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
a.thisown = 1
|
||||
if (!a.thisown) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
a.thisown = tmp
|
||||
if (a.thisown != tmp) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
|
||||
var b = new disown.B();
|
||||
b.acquire(a);
|
||||
if (a.thisown) {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
12
Examples/test-suite/javascript/dynamic_cast_runme.js
Normal file
12
Examples/test-suite/javascript/dynamic_cast_runme.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
var dynamic_cast = require("./dynamic_cast");
|
||||
|
||||
var f = new dynamic_cast.Foo();
|
||||
var b = new dynamic_cast.Bar();
|
||||
|
||||
var x = f.blah();
|
||||
var y = b.blah();
|
||||
|
||||
var a = dynamic_cast.do_test(y);
|
||||
if (a != "Bar::test") {
|
||||
throw new Error("Failed.");
|
||||
}
|
||||
1
Examples/test-suite/javascript/empty_runme.js
Normal file
1
Examples/test-suite/javascript/empty_runme.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
var empty = require("./empty");
|
||||
44
Examples/test-suite/javascript/varargs_runme.js
Normal file
44
Examples/test-suite/javascript/varargs_runme.js
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
var varargs = require("./varargs");
|
||||
|
||||
if (varargs.test("Hello") != "Hello") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
var f = new varargs.Foo("Greetings")
|
||||
if (f.str != "Greetings") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
if (f.test("Hello") != "Hello") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
if (varargs.test_def("Hello",1) != "Hello") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
if (varargs.test_def("Hello") != "Hello") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
if (varargs.test_plenty("Hello") != "Hello") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
if (varargs.test_plenty("Hello", 1) != "Hello") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
if (varargs.test_plenty("Hello", 1, 2) != "Hello") {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
|
||||
var thrown = false;
|
||||
try {
|
||||
varargs.test_plenty("Hello", 1, 2, 3);
|
||||
} catch (err) {
|
||||
thrown = true;
|
||||
}
|
||||
if (!thrown) {
|
||||
throw new Error("Failed");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue