diff --git a/compiler/testData/codegen/componentEvaluatesOnlyOnce.kt b/compiler/testData/codegen/bytecodeText/componentEvaluatesOnlyOnce.kt similarity index 89% rename from compiler/testData/codegen/componentEvaluatesOnlyOnce.kt rename to compiler/testData/codegen/bytecodeText/componentEvaluatesOnlyOnce.kt index ec5b515705b..251bf130ba9 100644 --- a/compiler/testData/codegen/componentEvaluatesOnlyOnce.kt +++ b/compiler/testData/codegen/bytecodeText/componentEvaluatesOnlyOnce.kt @@ -14,4 +14,6 @@ class Tester() { fun S.component4() = ((a + b) as java.lang.String).substring(2) } -fun box() = Tester().box() \ No newline at end of file +fun box() = Tester().box() + +// 1 NEW S diff --git a/compiler/testData/codegen/bytecodeText/intConstantNotNull.kt b/compiler/testData/codegen/bytecodeText/intConstantNotNull.kt new file mode 100644 index 00000000000..19523ee574d --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/intConstantNotNull.kt @@ -0,0 +1,3 @@ +fun foo() = 10!!.toString() + +// 0 IFNONNULL diff --git a/compiler/testData/codegen/bytecodeText/intConstantNullable.kt b/compiler/testData/codegen/bytecodeText/intConstantNullable.kt new file mode 100644 index 00000000000..648b9154190 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/intConstantNullable.kt @@ -0,0 +1,5 @@ +val a : Int? = 10 + +fun foo() = a!!.toString() + +// 1 IFNONNULL diff --git a/compiler/testData/codegen/bytecodeText/intConstantNullableSafeCall.kt b/compiler/testData/codegen/bytecodeText/intConstantNullableSafeCall.kt new file mode 100644 index 00000000000..a30633f2c43 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/intConstantNullableSafeCall.kt @@ -0,0 +1,5 @@ +val a : Int? = 10 + +fun foo() = a?.toString() + +// 1 IFNULL diff --git a/compiler/testData/codegen/bytecodeText/intConstantSafeCall.kt b/compiler/testData/codegen/bytecodeText/intConstantSafeCall.kt new file mode 100644 index 00000000000..b9db525dd0e --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/intConstantSafeCall.kt @@ -0,0 +1,3 @@ +fun foo() = 10?.toString() + +// 0 IFNULL diff --git a/compiler/testData/codegen/properties/kt2202.kt b/compiler/testData/codegen/bytecodeText/kt2202.kt similarity index 83% rename from compiler/testData/codegen/properties/kt2202.kt rename to compiler/testData/codegen/bytecodeText/kt2202.kt index c8c3801bead..2d62a6e896b 100644 --- a/compiler/testData/codegen/properties/kt2202.kt +++ b/compiler/testData/codegen/bytecodeText/kt2202.kt @@ -15,4 +15,7 @@ class B { fun foo() { foo = 2 } -} \ No newline at end of file +} + +// 0 INVOKEVIRTUAL +// 4 INVOKESPECIAL diff --git a/compiler/testData/codegen/super/kt2887.kt b/compiler/testData/codegen/bytecodeText/kt2887.kt similarity index 95% rename from compiler/testData/codegen/super/kt2887.kt rename to compiler/testData/codegen/bytecodeText/kt2887.kt index ed6adf83b7b..75e5970b7f6 100644 --- a/compiler/testData/codegen/super/kt2887.kt +++ b/compiler/testData/codegen/bytecodeText/kt2887.kt @@ -12,5 +12,6 @@ class Child: Base() { override fun bar() { super.bar() } - } + +// 1 bridge diff --git a/compiler/testData/codegen/functions/privateDefaultArgs.kt b/compiler/testData/codegen/bytecodeText/privateDefaultArgs.kt similarity index 83% rename from compiler/testData/codegen/functions/privateDefaultArgs.kt rename to compiler/testData/codegen/bytecodeText/privateDefaultArgs.kt index 261a0add314..699df18dff9 100644 --- a/compiler/testData/codegen/functions/privateDefaultArgs.kt +++ b/compiler/testData/codegen/bytecodeText/privateDefaultArgs.kt @@ -11,3 +11,6 @@ class B { fun box(): String { return "OK" } + +// 0 INVOKEVIRTUAL +// 3 INVOKESPECIAL diff --git a/compiler/testData/codegen/statements/ifSingleBranch.kt b/compiler/testData/codegen/bytecodeText/statements/ifSingleBranch.kt similarity index 86% rename from compiler/testData/codegen/statements/ifSingleBranch.kt rename to compiler/testData/codegen/bytecodeText/statements/ifSingleBranch.kt index 6ba8e14c210..da02a5ad6eb 100644 --- a/compiler/testData/codegen/statements/ifSingleBranch.kt +++ b/compiler/testData/codegen/bytecodeText/statements/ifSingleBranch.kt @@ -7,3 +7,5 @@ fun foo() { return } } + +// 0 GETSTATIC diff --git a/compiler/testData/codegen/statements/ifThenElse.kt b/compiler/testData/codegen/bytecodeText/statements/ifThenElse.kt similarity index 86% rename from compiler/testData/codegen/statements/ifThenElse.kt rename to compiler/testData/codegen/bytecodeText/statements/ifThenElse.kt index 72afa7658a9..17d461af963 100644 --- a/compiler/testData/codegen/statements/ifThenElse.kt +++ b/compiler/testData/codegen/bytecodeText/statements/ifThenElse.kt @@ -7,3 +7,5 @@ fun foo(b: Boolean) { z(b) } } + +// 0 GETSTATIC diff --git a/compiler/testData/codegen/statements/ifThenElseEmpty.kt b/compiler/testData/codegen/bytecodeText/statements/ifThenElseEmpty.kt similarity index 77% rename from compiler/testData/codegen/statements/ifThenElseEmpty.kt rename to compiler/testData/codegen/bytecodeText/statements/ifThenElseEmpty.kt index d7ac5e5d21f..fbb2506f7d2 100644 --- a/compiler/testData/codegen/statements/ifThenElseEmpty.kt +++ b/compiler/testData/codegen/bytecodeText/statements/ifThenElseEmpty.kt @@ -3,3 +3,5 @@ fun foo(b: Boolean) { } else { } } + +// 0 GETSTATIC diff --git a/compiler/testData/codegen/statements/tryCatchFinally.kt b/compiler/testData/codegen/bytecodeText/statements/tryCatchFinally.kt similarity index 94% rename from compiler/testData/codegen/statements/tryCatchFinally.kt rename to compiler/testData/codegen/bytecodeText/statements/tryCatchFinally.kt index 4dd0d8472bd..31145f208fe 100644 --- a/compiler/testData/codegen/statements/tryCatchFinally.kt +++ b/compiler/testData/codegen/bytecodeText/statements/tryCatchFinally.kt @@ -21,3 +21,5 @@ fun foo() { z() } } + +// 0 GETSTATIC diff --git a/compiler/testData/codegen/statements/when.kt b/compiler/testData/codegen/bytecodeText/statements/when.kt similarity index 87% rename from compiler/testData/codegen/statements/when.kt rename to compiler/testData/codegen/bytecodeText/statements/when.kt index 307393f9929..ebd54e4e546 100644 --- a/compiler/testData/codegen/statements/when.kt +++ b/compiler/testData/codegen/bytecodeText/statements/when.kt @@ -7,3 +7,5 @@ fun foo(x: Int) { else -> {} } } + +// 0 GETSTATIC diff --git a/compiler/testData/codegen/statements/whenSubject.kt b/compiler/testData/codegen/bytecodeText/statements/whenSubject.kt similarity index 87% rename from compiler/testData/codegen/statements/whenSubject.kt rename to compiler/testData/codegen/bytecodeText/statements/whenSubject.kt index 918b208630a..7293c38aca9 100644 --- a/compiler/testData/codegen/statements/whenSubject.kt +++ b/compiler/testData/codegen/bytecodeText/statements/whenSubject.kt @@ -7,3 +7,5 @@ fun foo(x: Int) { else -> {} } } + +// 0 GETSTATIC diff --git a/compiler/tests/org/jetbrains/jet/codegen/AbstractBytecodeTextTest.java b/compiler/tests/org/jetbrains/jet/codegen/AbstractBytecodeTextTest.java new file mode 100644 index 00000000000..5e7f9a2013b --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/codegen/AbstractBytecodeTextTest.java @@ -0,0 +1,87 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.codegen; + +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.ConfigurationKind; +import org.jetbrains.jet.utils.ExceptionUtils; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public abstract class AbstractBytecodeTextTest extends CodegenTestCase { + private static final Pattern EXPECTED_OCCURRENCES_PATTERN = Pattern.compile("^\\s*//\\s*(\\d+)\\s*(.*)$"); + + public void doTest(@NotNull String filename) throws Exception { + createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); + loadFileByFullPath(filename); + List expected = readExpectedOccurrences(filename); + countAndCompareActualOccurrences(expected); + } + + private void countAndCompareActualOccurrences(@NotNull List expectedOccurrences) { + StringBuilder expected = new StringBuilder(); + StringBuilder actual = new StringBuilder(); + + String text = generateToText(); + for (OccurrenceInfo info : expectedOccurrences) { + expected.append(info.numberOfOccurrences).append(" ").append(info.needle).append("\n"); + int actualCount = StringUtil.getOccurrenceCount(text, info.needle); + actual.append(actualCount).append(" ").append(info.needle).append("\n"); + } + + try { + assertEquals(expected.toString(), actual.toString()); + } + catch (Throwable e) { + System.out.println(text); + ExceptionUtils.rethrow(e); + } + } + + @NotNull + private List readExpectedOccurrences(@NotNull String filename) throws Exception { + List result = new ArrayList(); + String[] lines = FileUtil.loadFile(new File(filename), true).split("\n"); + + for (String line : lines) { + Matcher matcher = EXPECTED_OCCURRENCES_PATTERN.matcher(line); + if (matcher.matches()) { + int numberOfOccurrences = Integer.parseInt(matcher.group(1)); + String needle = matcher.group(2); + result.add(new OccurrenceInfo(numberOfOccurrences, needle)); + } + } + + return result; + } + + private static class OccurrenceInfo { + private final int numberOfOccurrences; + private final String needle; + + private OccurrenceInfo(int numberOfOccurrences, @NotNull String needle) { + this.numberOfOccurrences = numberOfOccurrences; + this.needle = needle; + } + } +} diff --git a/compiler/tests/org/jetbrains/jet/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/BytecodeTextTestGenerated.java new file mode 100644 index 00000000000..70572aea489 --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/codegen/BytecodeTextTestGenerated.java @@ -0,0 +1,124 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.codegen; + +import junit.framework.Assert; +import junit.framework.Test; +import junit.framework.TestSuite; + +import java.io.File; +import java.util.regex.Pattern; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.InnerTestClasses; +import org.jetbrains.jet.test.TestMetadata; + +import org.jetbrains.jet.codegen.AbstractBytecodeTextTest; + +/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/codegen/bytecodeText") +@InnerTestClasses({BytecodeTextTestGenerated.Statements.class}) +public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { + public void testAllFilesPresentInBytecodeText() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/bytecodeText"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("componentEvaluatesOnlyOnce.kt") + public void testComponentEvaluatesOnlyOnce() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/componentEvaluatesOnlyOnce.kt"); + } + + @TestMetadata("intConstantNotNull.kt") + public void testIntConstantNotNull() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/intConstantNotNull.kt"); + } + + @TestMetadata("intConstantNullable.kt") + public void testIntConstantNullable() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/intConstantNullable.kt"); + } + + @TestMetadata("intConstantNullableSafeCall.kt") + public void testIntConstantNullableSafeCall() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/intConstantNullableSafeCall.kt"); + } + + @TestMetadata("intConstantSafeCall.kt") + public void testIntConstantSafeCall() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/intConstantSafeCall.kt"); + } + + @TestMetadata("kt2202.kt") + public void testKt2202() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/kt2202.kt"); + } + + @TestMetadata("kt2887.kt") + public void testKt2887() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/kt2887.kt"); + } + + @TestMetadata("privateDefaultArgs.kt") + public void testPrivateDefaultArgs() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/privateDefaultArgs.kt"); + } + + @TestMetadata("compiler/testData/codegen/bytecodeText/statements") + public static class Statements extends AbstractBytecodeTextTest { + public void testAllFilesPresentInStatements() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/bytecodeText/statements"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("ifSingleBranch.kt") + public void testIfSingleBranch() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/statements/ifSingleBranch.kt"); + } + + @TestMetadata("ifThenElse.kt") + public void testIfThenElse() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/statements/ifThenElse.kt"); + } + + @TestMetadata("ifThenElseEmpty.kt") + public void testIfThenElseEmpty() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/statements/ifThenElseEmpty.kt"); + } + + @TestMetadata("tryCatchFinally.kt") + public void testTryCatchFinally() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/statements/tryCatchFinally.kt"); + } + + @TestMetadata("when.kt") + public void testWhen() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/statements/when.kt"); + } + + @TestMetadata("whenSubject.kt") + public void testWhenSubject() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/statements/whenSubject.kt"); + } + + } + + public static Test suite() { + TestSuite suite = new TestSuite("BytecodeTextTestGenerated"); + suite.addTestSuite(BytecodeTextTestGenerated.class); + suite.addTestSuite(Statements.class); + return suite; + } +} diff --git a/compiler/tests/org/jetbrains/jet/codegen/ComponentGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ComponentGenTest.java deleted file mode 100644 index 31e87a480d7..00000000000 --- a/compiler/tests/org/jetbrains/jet/codegen/ComponentGenTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2010-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.jet.codegen; - -import org.apache.commons.lang.StringUtils; -import org.jetbrains.jet.ConfigurationKind; - -/** - * This test is separate from MultiDeclTestGenerated because we specifically test generated bytecode - * that expression does not evaluated several time - */ -public class ComponentGenTest extends CodegenTestCase { - public void testComponent() { - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); - loadFile("componentEvaluatesOnlyOnce.kt"); - assertEquals(1, StringUtils.countMatches(generateToText(), "NEW S\n")); - } -} diff --git a/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java index e92c878112d..8dadb1a51fa 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java @@ -54,11 +54,4 @@ public class FunctionGenTest extends CodegenTestCase { assertTrue((Boolean) foo.invoke(null, "lala")); assertFalse((Boolean) foo.invoke(null, "mama")); } - - public void testPrivateDefaultArgs() throws Exception { - loadFile("functions/privateDefaultArgs.kt"); - String text = generateToText(); - assertFalse(text.contains("INVOKEVIRTUAL")); - assertTrue(text.contains("INVOKESPECIAL")); - } } diff --git a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java index d30a74adfa1..6163aa8619b 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java @@ -271,24 +271,4 @@ public class PrimitiveTypesTest extends CodegenTestCase { final Method main = generateFunction(); assertEquals(expected, main.invoke(null, arg1, arg2)); } - - public void testSureNonnull () throws Exception { - loadText("fun box() = 10!!.toString()"); - assertFalse(generateToText().contains("IFNONNULL")); - } - - public void testSureNullable () throws Exception { - loadText("val a : Int? = 10; fun box() = a!!.toString()"); - assertTrue(generateToText().contains("IFNONNULL")); - } - - public void testSafeNonnull () throws Exception { - loadText("fun box() = 10?.toString()"); - assertFalse(generateToText().contains("IFNULL")); - } - - public void testSafeNullable () throws Exception { - loadText("val a : Int? = 10; fun box() = a?.toString()"); - assertTrue(generateToText().contains("IFNULL")); - } } diff --git a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java index 95d6506d48f..bbb9790b5bb 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java @@ -259,12 +259,4 @@ public class PropertyGenTest extends CodegenTestCase { throw new RuntimeException(e); } } - - public void testKt2202() { - loadFile("properties/kt2202.kt"); - String text = generateToText(); - assertFalse(text.contains("INVOKEVIRTUAL")); - assertTrue(text.contains("INVOKESPECIAL")); - } - } diff --git a/compiler/tests/org/jetbrains/jet/codegen/StatementGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/StatementGenTest.java deleted file mode 100644 index 6bf93aa12c8..00000000000 --- a/compiler/tests/org/jetbrains/jet/codegen/StatementGenTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2010-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.jet.codegen; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.ConfigurationKind; - -public class StatementGenTest extends CodegenTestCase { - @Override - protected void setUp() throws Exception { - super.setUp(); - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); - } - - private void doTest() { - loadFile("statements/" + getTestName(true) + ".kt"); - String text = generateToText(); - // 'getstatic' means we refer to Unit.VALUE, which we shouldn't since these tests contain only statements - assertNoGetStatic(text); - } - - private void assertNoGetStatic(@NotNull String text) { - assertFalse(text, text.toLowerCase().contains("getstatic")); - } - - public void testIfSingleBranch() { - doTest(); - } - - public void testIfThenElse() { - doTest(); - } - - public void testIfThenElseEmpty() { - doTest(); - } - - public void testTryCatchFinally() { - doTest(); - } - - public void testWhen() { - doTest(); - } - - public void testWhenSubject() { - doTest(); - } -} diff --git a/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java deleted file mode 100644 index cc34fc548b7..00000000000 --- a/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2010-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.jet.codegen; - -import org.apache.commons.lang.StringUtils; -import org.jetbrains.jet.ConfigurationKind; - -public class SuperGenTest extends CodegenTestCase { - - @Override - protected void setUp() throws Exception { - super.setUp(); - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); - } - - public void testKt2887() { - loadFile("super/kt2887.kt"); - String text = generateToText(); - // There should be exactly one bridge in this example - assertEquals(1, StringUtils.countMatches(text, "bridge")); - } -} diff --git a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java index 678dd8a43f5..23e29daad6a 100644 --- a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java +++ b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java @@ -20,6 +20,7 @@ import junit.framework.TestCase; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve; import org.jetbrains.jet.checkers.AbstractJetPsiCheckerTest; +import org.jetbrains.jet.codegen.AbstractBytecodeTextTest; import org.jetbrains.jet.codegen.AbstractCheckLocalVariablesTableTest; import org.jetbrains.jet.codegen.defaultConstructor.AbstractDefaultConstructorCodegenTest; import org.jetbrains.jet.codegen.flags.AbstractWriteFlagsTest; @@ -96,6 +97,13 @@ public class GenerateTests { testModel("compiler/testData/codegen/boxWithStdlib", "doTestWithStdlib") ); + generateTest( + "compiler/tests/", + "BytecodeTextTestGenerated", + AbstractBytecodeTextTest.class, + testModel("compiler/testData/codegen/bytecodeText") + ); + generateTest( "compiler/tests/", "CheckLocalVariablesTableTestGenerated",