enhance tests (mostly codegen)

* drop dependency on stdlib/alt-headers in the most tests
* assign to myEnvironment at most once in JetLiteFixture
* more tests do not compile runtime
This commit is contained in:
Stepan Koltsov
2012-05-01 19:11:48 +04:00
parent 90910cae34
commit 95f9bcbacb
43 changed files with 379 additions and 44 deletions
@@ -24,6 +24,7 @@ import org.jetbrains.jet.analyzer.AnalyzeExhaust;
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
import org.jetbrains.jet.parsing.JetParsingTest;
@@ -127,8 +128,9 @@ public abstract class CodegenTestCase extends JetLiteFixture {
private GenerationState generateCommon(ClassBuilderFactory classBuilderFactory) {
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegrationAndCheckForErrors(
myFile, JetControlFlowDataTraceFactory.EMPTY,
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, false));
myEnvironment.getCompilerDependencies());
analyzeExhaust.throwIfError();
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
GenerationState state = new GenerationState(getProject(), classBuilderFactory, analyzeExhaust, Collections.singletonList(myFile));
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
return state;
@@ -194,8 +196,7 @@ public abstract class CodegenTestCase extends JetLiteFixture {
r = method;
}
if (r == null)
throw new AssertionError();
if (r == null) { throw new AssertionError(); }
return r;
} catch (Error e) {
System.out.println(generateToText());