Add test for nullable primitive in range

This commit is contained in:
Dmitry Petrov
2017-07-03 14:51:20 +03:00
parent db1dcc68ff
commit 6551fdc695
5 changed files with 38 additions and 0 deletions
@@ -0,0 +1,14 @@
// WITH_RUNTIME
val x: Int? = 42
val n: Int? = null
fun box(): String {
if (x in 0..2) return "Fail in"
if (!(x !in 0..2)) return "Fail !in"
if (n in 0..2) return "Fail in null"
if (!(n !in 0..2)) return "Fail !in null"
return "OK"
}
@@ -13315,6 +13315,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("nullableInPrimitiveRange.kt")
public void testNullableInPrimitiveRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/nullableInPrimitiveRange.kt");
doTest(fileName);
}
@TestMetadata("rangeContainsString.kt")
public void testRangeContainsString() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");
@@ -13315,6 +13315,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("nullableInPrimitiveRange.kt")
public void testNullableInPrimitiveRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/nullableInPrimitiveRange.kt");
doTest(fileName);
}
@TestMetadata("rangeContainsString.kt")
public void testRangeContainsString() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");
@@ -13315,6 +13315,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
doTest(fileName);
}
@TestMetadata("nullableInPrimitiveRange.kt")
public void testNullableInPrimitiveRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/nullableInPrimitiveRange.kt");
doTest(fileName);
}
@TestMetadata("rangeContainsString.kt")
public void testRangeContainsString() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");
@@ -14995,6 +14995,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
doTest(fileName);
}
@TestMetadata("nullableInPrimitiveRange.kt")
public void testNullableInPrimitiveRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/nullableInPrimitiveRange.kt");
doTest(fileName);
}
@TestMetadata("rangeContainsString.kt")
public void testRangeContainsString() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt");