diff --git a/compiler/testData/codegen/PSVM.kt b/compiler/testData/codegen/PSVM.kt deleted file mode 100644 index 4a52adcbbf5..00000000000 --- a/compiler/testData/codegen/PSVM.kt +++ /dev/null @@ -1,5 +0,0 @@ -package foo - -fun main(args : Array) { - -} diff --git a/compiler/testData/codegen/assign.kt b/compiler/testData/codegen/assign.kt deleted file mode 100644 index c552d47eb6c..00000000000 --- a/compiler/testData/codegen/assign.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun f(): Int { - var x: Int = 1 - x = x + 1 - return x -} diff --git a/compiler/testData/codegen/bottles.kt b/compiler/testData/codegen/bottles.kt deleted file mode 100644 index 077257e21dd..00000000000 --- a/compiler/testData/codegen/bottles.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun main() { - var bottles = 99; - while(bottles > 0) { - System.out?.println("bottles of beer on the wall"); - bottles--; - } -} diff --git a/compiler/testData/codegen/bottles2.kt b/compiler/testData/codegen/bottles2.kt deleted file mode 100644 index da885824b9f..00000000000 --- a/compiler/testData/codegen/bottles2.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun main() { - var bottles = 99; - while(bottles > 0) { - System.out?.println("bottles of beer on the wall"); - bottles -= 1; - } -} diff --git a/compiler/testData/codegen/box/controlStructures/bottles.kt b/compiler/testData/codegen/box/controlStructures/bottles.kt new file mode 100644 index 00000000000..2d376593843 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/bottles.kt @@ -0,0 +1,9 @@ +fun box(): String { + var bottles = 99 + while (bottles > 0) { + // System.out.println("bottles of beer on the wall"); + bottles -= 1 + bottles-- + } + return if (bottles == -1) "OK" else "Fail $bottles" +} diff --git a/compiler/testData/codegen/functionCall.kt b/compiler/testData/codegen/functionCall.kt deleted file mode 100644 index 6205f16638f..00000000000 --- a/compiler/testData/codegen/functionCall.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun f() : String? { - val x = StringBuilder(); - g(x); - return x.toString(); -} - -fun g(sb: StringBuilder): Unit { - sb.append("foo"); -} diff --git a/compiler/testData/codegen/helloWorld.kt b/compiler/testData/codegen/helloWorld.kt deleted file mode 100644 index eff2e27a792..00000000000 --- a/compiler/testData/codegen/helloWorld.kt +++ /dev/null @@ -1 +0,0 @@ -fun f() { System.out?.println("Hello World"); } diff --git a/compiler/testData/codegen/localProperty.kt b/compiler/testData/codegen/localProperty.kt deleted file mode 100644 index 2c14afc8fb4..00000000000 --- a/compiler/testData/codegen/localProperty.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun f(a:Int) : Int { - val x = 42 - val y = 50 - - return y -} diff --git a/compiler/testData/codegen/newInstanceExplicitConstructor.kt b/compiler/testData/codegen/newInstanceExplicitConstructor.kt deleted file mode 100644 index 26de34c0477..00000000000 --- a/compiler/testData/codegen/newInstanceExplicitConstructor.kt +++ /dev/null @@ -1,10 +0,0 @@ -class SimpleClass { - this() {} - - fun foo() = 610 -} - -fun test() { - val c = SimpleClass() - return c.foo() -} diff --git a/compiler/testData/codegen/systemOut.kt b/compiler/testData/codegen/systemOut.kt deleted file mode 100644 index d2e9f7c904f..00000000000 --- a/compiler/testData/codegen/systemOut.kt +++ /dev/null @@ -1 +0,0 @@ -fun f() : Any? { return System.out; } \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/PackageGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/PackageGenTest.java index f5880bf6f4c..a7366fd3e7c 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PackageGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PackageGenTest.java @@ -16,6 +16,7 @@ package org.jetbrains.jet.codegen; +import com.intellij.util.ArrayUtil; import org.jetbrains.jet.ConfigurationKind; import java.awt.*; @@ -36,9 +37,9 @@ public class PackageGenTest extends CodegenTestCase { } public void testPSVM() throws Exception { - loadFile("PSVM.kt"); + loadText("fun main(args: Array) { }"); Method main = generateFunction(); - Object[] args = new Object[] { new String[0] }; + Object[] args = new Object[] {ArrayUtil.EMPTY_STRING_ARRAY}; main.invoke(null, args); } @@ -56,13 +57,6 @@ public class PackageGenTest extends CodegenTestCase { assertEquals(new Integer(50), returnValue); } - public void testLocalProperty() throws Exception { - loadFile("localProperty.kt"); - Method main = generateFunction(); - Object returnValue = main.invoke(null, 76); - assertEquals(new Integer(50), returnValue); - } - public void testCurrentTime() throws Exception { loadText("fun f() : Long { return System.currentTimeMillis(); }"); Method main = generateFunction(); @@ -79,24 +73,12 @@ public class PackageGenTest extends CodegenTestCase { } public void testSystemOut() throws Exception { - loadFile("systemOut.kt"); + loadText("fun f() : Any? { return System.out; }"); Method main = generateFunction(); Object returnValue = main.invoke(null); assertEquals(returnValue, System.out); } - public void testHelloWorld() throws Exception { - loadFile("helloWorld.kt"); - generateFunction(); // assert that it can be verified - } - - public void testAssign() throws Exception { - loadFile("assign.kt"); - - Method main = generateFunction(); - assertEquals(2, main.invoke(null)); - } - public void testBoxedInt() throws Exception { loadText("fun foo(a: Int?) = if (a != null) a else 239"); Method main = generateFunction(); @@ -172,12 +154,6 @@ public class PackageGenTest extends CodegenTestCase { assertTrue(hadException); } - public void testBottles2() throws Exception { - loadFile("bottles2.kt"); - Method main = generateFunction(); - main.invoke(null); // ensure no exception - } - public void testJavaConstructor() throws Exception { loadText("fun foo(): StringBuilder = StringBuilder()"); Method main = generateFunction(); @@ -239,12 +215,6 @@ public class PackageGenTest extends CodegenTestCase { assertEquals(Boolean.TRUE, main.invoke(null, s1, s2)); } - public void testFunctionCall() throws Exception { - loadFile("functionCall.kt"); - Method main = generateFunction("f"); - assertEquals("foo", main.invoke(null)); - } - public void testStringPlus() throws Exception { loadText("fun foo(s1: String, s2: String) = s1 + s2"); Method main = generateFunction(); diff --git a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java index b3429699a98..5240d14ec35 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java @@ -261,12 +261,6 @@ public class PrimitiveTypesTest extends CodegenTestCase { assertEquals(6L, main.invoke(null, 2L)); } - public void testDecrementAsStatement() throws Exception { - loadFile("bottles.kt"); - Method main = generateFunction(); - main.invoke(null); // ensure no exception - } - private void binOpTest(String text, Object arg1, Object arg2, Object expected) throws Exception { loadText(text); Method main = generateFunction(); diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java index 58aa8d6f588..73fb324e231 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java @@ -1770,6 +1770,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/controlStructures"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("bottles.kt") + public void testBottles() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/bottles.kt"); + doTest(fileName); + } + @TestMetadata("compareBoxedIntegerToZero.kt") public void testCompareBoxedIntegerToZero() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/compareBoxedIntegerToZero.kt");