JS: create new common directory for all generated tests, migrate several tests there
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
// http://youtrack.jetbrains.com/issue/KT-4879
|
||||
// JS: extra side effect when use when in default arguments
|
||||
|
||||
package foo
|
||||
|
||||
var global: String = ""
|
||||
|
||||
fun bar(): Int {
|
||||
global += ":bar:"
|
||||
return 100
|
||||
}
|
||||
|
||||
fun foo(a: Int = when { else -> bar() }): Int = a + 1
|
||||
|
||||
fun bar0(x: String = try { global } finally {}): String {
|
||||
return "bar: ${x}"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
global = ""
|
||||
assertEquals(101, foo(100))
|
||||
assertEquals("", global)
|
||||
|
||||
assertEquals(101, foo())
|
||||
assertEquals(":bar:", global)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user