JS: create new common directory for all generated tests, migrate several tests there

This commit is contained in:
Alexey Andreev
2016-08-26 16:44:48 +03:00
parent 34a57f863b
commit 2bf0199959
321 changed files with 2123 additions and 2001 deletions
@@ -0,0 +1,11 @@
package foo
val Double.abs: Double
get() = if (this > 0) this else -this
fun box(): String {
if (4.0.abs != 4.0) return "fail1";
if ((-5.2).abs != 5.2) return "fail2";
return "OK";
}
@@ -0,0 +1,26 @@
package foo
class Test() {
var a = 0
}
var Test.b: Int
get() = a * 3
set(c: Int) {
a = c - 1
}
val Test.d: Int get() = 44
fun box(): String {
val c = Test()
if (c.a != 0) return "fail1: ${c.a}";
if (c.b != 0) return "fail2: ${c.b}";
c.a = 3;
if (c.b != 9) return "fail3: ${c.a}";
c.b = 10;
if (c.a != 9) return "fail4: ${c.a}";
if (c.b != 27) return "fail5: ${c.b}";
if (c.d != 44) return "fail6: ${c.d}";
return "OK";
}
@@ -0,0 +1,16 @@
package foo
val String.prop: Int
get() = length
val Int.quadruple: Int
get() = this * 4
fun box(): String {
if ("1".prop != 1) return "fail1";
if ("11".prop != 2) return "fail2";
if (("121" + "123").prop != 6) return "fail3";
if (1.quadruple != 4) return "fail4";
if (0.quadruple != 0) return "fail5";
return "OK";
}