JS backend: added tests for infix calls.

#KT-3998   in progress
 #EA-56241 in progress
This commit is contained in:
Zalim Bashorov
2014-05-08 15:54:05 +04:00
parent 235b03c407
commit 898275e658
6 changed files with 99 additions and 1 deletions
@@ -0,0 +1,23 @@
// EA-56241
package foo
fun Int.foo(a: Int) = this + a
val bar = { Int.(a: Int) -> this * a }
fun test(op: Int.(Int) -> Int) = 3 op 20
fun assertEquals<T>(expected: T, actual: T) {
if (expected != actual) throw Exception("expected: $expected, actual: $actual")
}
fun box(): String {
val op = { Int.(a: Int) -> this / a }
assertEquals(41, 34 foo 7)
assertEquals(28, 4 bar 7)
assertEquals(-17, test { this - it })
assertEquals(7, 49 op 7)
return "OK"
}