JS: add test to prove that KT-13523 is no more reproducible

This commit is contained in:
Alexey Andreev
2016-12-27 15:33:01 +03:00
parent 27c2a4f6a8
commit 175d37fdc8
6 changed files with 78 additions and 0 deletions
@@ -0,0 +1,33 @@
var log = ""
fun foo(): Int {
log += "foo;"
return 1
}
fun bar(): Int {
log += "bar;"
return 42
}
data class A(val x: Int) {
operator fun plus(other: A) = A(x + other.x)
}
fun box(): String {
val array = arrayOf(0, 1)
array[foo()] += bar()
if (array[0] != 0) return "fail1a: ${array[0]}"
if (array[1] != 43) return "fail1b: ${array[0]}"
log += "!;"
val objArray = arrayOf(A(0), A(1))
objArray[foo()] += A(bar())
if (objArray[0] != A(0)) return "fail2a: ${array[0]}"
if (objArray[1] != A(43)) return "fail2b: ${array[0]}"
if (log != "foo;bar;!;foo;bar;") return "fail3: $log"
return "OK"
}
@@ -0,0 +1,21 @@
public final class A {
private final field x: int
public method <init>(p0: int): void
public final method component1(): int
public synthetic static method copy$default(p0: A, p1: int, p2: int, p3: java.lang.Object): A
public final @org.jetbrains.annotations.NotNull method copy(p0: int): A
public method equals(p0: java.lang.Object): boolean
public final method getX(): int
public method hashCode(): int
public final @org.jetbrains.annotations.NotNull method plus(@org.jetbrains.annotations.NotNull p0: A): A
public method toString(): java.lang.String
}
public final class AugmentedAssignmentWithArrayLHSKt {
private static @org.jetbrains.annotations.NotNull field log: java.lang.String
public final static method bar(): int
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method foo(): int
public final static @org.jetbrains.annotations.NotNull method getLog(): java.lang.String
public final static method setLog(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
@@ -10595,6 +10595,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("augmentedAssignmentWithArrayLHS.kt")
public void testAugmentedAssignmentWithArrayLHS() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt");
doTest(fileName);
}
@TestMetadata("incDecOnObject.kt")
public void testIncDecOnObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/incDecOnObject.kt");
@@ -10595,6 +10595,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("augmentedAssignmentWithArrayLHS.kt")
public void testAugmentedAssignmentWithArrayLHS() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt");
doTest(fileName);
}
@TestMetadata("incDecOnObject.kt")
public void testIncDecOnObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/incDecOnObject.kt");
@@ -10595,6 +10595,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
doTest(fileName);
}
@TestMetadata("augmentedAssignmentWithArrayLHS.kt")
public void testAugmentedAssignmentWithArrayLHS() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt");
doTest(fileName);
}
@TestMetadata("incDecOnObject.kt")
public void testIncDecOnObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/incDecOnObject.kt");
@@ -12456,6 +12456,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
doTest(fileName);
}
@TestMetadata("augmentedAssignmentWithArrayLHS.kt")
public void testAugmentedAssignmentWithArrayLHS() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/augmentedAssignmentWithArrayLHS.kt");
doTest(fileName);
}
@TestMetadata("incDecOnObject.kt")
public void testIncDecOnObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/incDecOnObject.kt");