Kill blackBoxFile()

If your test is supposed to use blackBoxFile(), maybe it should be placed into
box/boxWithStdlib directory
This commit is contained in:
Alexander Udalov
2013-02-07 22:40:25 +04:00
committed by Alexander Udalov
parent 31231fe18b
commit 9df3c22097
5 changed files with 10 additions and 18 deletions
@@ -6,12 +6,12 @@ public abstract class doGenerateParamAssertions {
public abstract void bar(@NotNull String s); public abstract void bar(@NotNull String s);
public static String foo(doGenerateParamAssertions a) { public static void foo(doGenerateParamAssertions a) {
try { try {
a.bar(null); a.bar(null);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return "OK"; return;
} }
return "Fail: AssertionError expected"; throw new AssertionError("Fail: IllegalArgumentException expected");
} }
} }
@@ -5,4 +5,4 @@ class A : C() {
} }
} }
fun box() = C.foo(A()) fun doTest() = C.foo(A())
@@ -105,10 +105,6 @@ public abstract class CodegenTestCase extends UsefulTestCase {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
protected void blackBoxFile(@NotNull String filename) {
blackBoxMultiFile(filename);
}
protected void blackBoxFileByFullPath(@NotNull String filename) { protected void blackBoxFileByFullPath(@NotNull String filename) {
loadFileByFullPath(filename); loadFileByFullPath(filename);
blackBox(); blackBox();
@@ -148,7 +144,7 @@ public abstract class CodegenTestCase extends UsefulTestCase {
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests( myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory)); ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory));
blackBoxFile(ktFile); blackBoxMultiFile(ktFile);
} }
@NotNull @NotNull
@@ -16,6 +16,7 @@
package org.jetbrains.jet.codegen; package org.jetbrains.jet.codegen;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.jet.ConfigurationKind; import org.jetbrains.jet.ConfigurationKind;
/** /**
@@ -25,13 +26,7 @@ import org.jetbrains.jet.ConfigurationKind;
public class ComponentGenTest extends CodegenTestCase { public class ComponentGenTest extends CodegenTestCase {
public void testComponent() { public void testComponent() {
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
blackBoxFile("componentEvaluatesOnlyOnce.kt"); loadFile("componentEvaluatesOnlyOnce.kt");
assertEquals(1, StringUtils.countMatches(generateToText(), "NEW S\n"));
String asm = generateToText();
//System.out.println(asm);
final String pattern = "NEW S\n";
final int index = asm.indexOf(pattern);
asm = asm.substring(index + pattern.length());
assertEquals(-1, asm.indexOf(pattern));
} }
} }
@@ -100,7 +100,8 @@ public class GenerateNotNullAssertionsTest extends CodegenTestCase {
setUpEnvironment(false, true, javaClassesTempDirectory); setUpEnvironment(false, true, javaClassesTempDirectory);
blackBoxFile("notNullAssertions/doGenerateParamAssertions.kt"); loadFile("notNullAssertions/doGenerateParamAssertions.kt");
generateFunction().invoke(null);
} }
public void testDoNotGenerateParamAssertions() throws Exception { public void testDoNotGenerateParamAssertions() throws Exception {