JS backend: test for KT-2901: nullable type in string template
This commit is contained in:
@@ -86,4 +86,8 @@ public final class StringTest extends AbstractExpressionTest {
|
|||||||
public void testExtensionMethods() throws Exception {
|
public void testExtensionMethods() throws Exception {
|
||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testNullableTypeInStringTemplate() throws Exception {
|
||||||
|
checkFooBoxIsOk();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// KT-2901 nullable type in string template
|
||||||
|
package foo
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var a: Int? = null
|
||||||
|
|
||||||
|
assertEquals("a: null", "a: ${a}")
|
||||||
|
|
||||||
|
a = 10
|
||||||
|
assertEquals("a: 10", "a: ${a}")
|
||||||
|
|
||||||
|
var s: String? = null
|
||||||
|
assertEquals("s: null", "s: $s")
|
||||||
|
|
||||||
|
s = "test"
|
||||||
|
assertEquals("s: test", "s: $s")
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user