Tests for multi-decl for-loops over arrays of primitives
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
fun Int.component1() = this + 1
|
||||||
|
fun Int.component2() = this + 2
|
||||||
|
|
||||||
|
fun doTest(l : Array<Int>): String {
|
||||||
|
var s = ""
|
||||||
|
for ((a, b) in l) {
|
||||||
|
s += "$a:$b;"
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val l = Array<Int>(3, {x -> x})
|
||||||
|
val s = doTest(l)
|
||||||
|
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
class M {
|
||||||
|
fun Int.component1() = this + 1
|
||||||
|
fun Int.component2() = this + 2
|
||||||
|
|
||||||
|
fun doTest(l : Array<Int>): String {
|
||||||
|
var s = ""
|
||||||
|
for ((a, b) in l) {
|
||||||
|
s += "$a:$b;"
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val l = Array<Int>(3, {x -> x})
|
||||||
|
val s = M().doTest(l)
|
||||||
|
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
class M {
|
||||||
|
fun Int.component1() = this + 1
|
||||||
|
fun Int.component2() = this + 2
|
||||||
|
}
|
||||||
|
|
||||||
|
fun M.doTest(l : Array<Int>): String {
|
||||||
|
var s = ""
|
||||||
|
for ((a, b) in l) {
|
||||||
|
s += "$a:$b;"
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val l = Array<Int>(3, {x -> x})
|
||||||
|
val s = M().doTest(l)
|
||||||
|
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
fun Long.component1() = this + 1
|
||||||
|
fun Long.component2() = this + 2
|
||||||
|
|
||||||
|
fun doTest(l : Array<Long>): String {
|
||||||
|
var s = ""
|
||||||
|
for ((a, b) in l) {
|
||||||
|
s += "$a:$b;"
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val l = Array<Long>(3, {x -> x.toLong()})
|
||||||
|
val s = doTest(l)
|
||||||
|
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
class M {
|
||||||
|
fun Long.component1() = this + 1
|
||||||
|
fun Long.component2() = this + 2
|
||||||
|
|
||||||
|
fun doTest(l : Array<Long>): String {
|
||||||
|
var s = ""
|
||||||
|
for ((a, b) in l) {
|
||||||
|
s += "$a:$b;"
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val l = Array<Long>(3, {x -> x.toLong()})
|
||||||
|
val s = M().doTest(l)
|
||||||
|
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
class M {
|
||||||
|
fun Long.component1() = this + 1
|
||||||
|
fun Long.component2() = this + 2
|
||||||
|
}
|
||||||
|
|
||||||
|
fun M.doTest(l : Array<Long>): String {
|
||||||
|
var s = ""
|
||||||
|
for ((a, b) in l) {
|
||||||
|
s += "$a:$b;"
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val l = Array<Long>(3, {x -> x.toLong()})
|
||||||
|
val s = M().doTest(l)
|
||||||
|
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
|
||||||
|
}
|
||||||
@@ -113,6 +113,59 @@ public class MultiDeclTestGenerated extends AbstractMultiDeclTestCase {
|
|||||||
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/MultiDeclForValCaptured.kt");
|
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/MultiDeclForValCaptured.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/multiDecl/forArray/int")
|
||||||
|
public static class Int extends AbstractMultiDeclTestCase {
|
||||||
|
public void testAllFilesPresentInInt() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forArray/int"), "kt", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("MultiDeclForComponentExtensions.kt")
|
||||||
|
public void testMultiDeclForComponentExtensions() throws Exception {
|
||||||
|
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/int/MultiDeclForComponentExtensions.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
|
||||||
|
public void testMultiDeclForComponentMemberExtensions() throws Exception {
|
||||||
|
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/int/MultiDeclForComponentMemberExtensions.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
|
||||||
|
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
|
||||||
|
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/multiDecl/forArray/long")
|
||||||
|
public static class Long extends AbstractMultiDeclTestCase {
|
||||||
|
public void testAllFilesPresentInLong() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forArray/long"), "kt", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("MultiDeclForComponentExtensions.kt")
|
||||||
|
public void testMultiDeclForComponentExtensions() throws Exception {
|
||||||
|
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/long/MultiDeclForComponentExtensions.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
|
||||||
|
public void testMultiDeclForComponentMemberExtensions() throws Exception {
|
||||||
|
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/long/MultiDeclForComponentMemberExtensions.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
|
||||||
|
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
|
||||||
|
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forArray/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Test innerSuite() {
|
||||||
|
TestSuite suite = new TestSuite("ForArray");
|
||||||
|
suite.addTestSuite(ForArray.class);
|
||||||
|
suite.addTestSuite(Int.class);
|
||||||
|
suite.addTestSuite(Long.class);
|
||||||
|
return suite;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/multiDecl/forIterator")
|
@TestMetadata("compiler/testData/codegen/multiDecl/forIterator")
|
||||||
@@ -151,7 +204,7 @@ public class MultiDeclTestGenerated extends AbstractMultiDeclTestCase {
|
|||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite = new TestSuite("MultiDeclTestGenerated");
|
TestSuite suite = new TestSuite("MultiDeclTestGenerated");
|
||||||
suite.addTestSuite(MultiDeclTestGenerated.class);
|
suite.addTestSuite(MultiDeclTestGenerated.class);
|
||||||
suite.addTestSuite(ForArray.class);
|
suite.addTest(ForArray.innerSuite());
|
||||||
suite.addTestSuite(ForIterator.class);
|
suite.addTestSuite(ForIterator.class);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user