JS tests: added tests for dynamic.

This commit is contained in:
Zalim Bashorov
2014-12-09 23:07:25 +03:00
parent 7d9b824411
commit af82e69214
25 changed files with 723 additions and 0 deletions
@@ -0,0 +1,34 @@
var bar = {
boo: function (a) {
return "bar.boo(" + a + ")";
},
invoke: function () {
return renderInvocation("bar.invoke", arguments)
},
num: 42,
str: "ok!",
obj: {
name: "bar.obj"
},
1: {
one: "1.one"
},
5: 0,
0 : "zero",
get: function(a, b, c) {
return renderInvocation("bar.get", arguments)
},
set: function(a, b, c) {
return renderInvocation("bar.set", arguments)
}
};
var arr = [{ it : "is", 1 : "object" }, 65, undefined, -2, "Yo!"];
function baz() {
return renderInvocation("baz", arguments)
}
function renderInvocation(prefix, args) {
return prefix + "(" + Array.prototype.slice.call(args) + ")"
}
@@ -0,0 +1,29 @@
package foo
native
var bar: dynamic = noImpl
native
var arr: dynamic = noImpl
native
var baz: dynamic = noImpl
native
val undefined: Nothing? = noImpl
object t {
override fun toString() = "object t {}"
}
object n {
fun valueOf() = 42
}
fun testTrue(f: () -> Boolean) {
assertTrue(f(), f.toString())
}
fun testFalse(f: () -> Boolean) {
assertFalse(f(), f.toString())
}