JS: decomposition of ternary operator

This commit is contained in:
Alexey Tsvetkov
2015-04-10 18:09:51 +03:00
parent 3782b9d382
commit fd844ad6e3
7 changed files with 137 additions and 0 deletions
@@ -0,0 +1,14 @@
package foo
fun test(x: Boolean?): Boolean = buzz(x) ?: fizz(true)
fun box(): String {
assertEquals(true, test(null))
assertEquals("buzz(null);fizz(true);", pullLog())
assertEquals(false, test(false))
assertEquals("buzz(false);", pullLog())
assertEquals(true, test(true))
assertEquals("buzz(true);", pullLog())
return "OK"
}