Extract junit testcase, delete unneeded code

This commit is contained in:
Alexander Udalov
2013-02-07 21:07:33 +04:00
committed by Alexander Udalov
parent 8a605b3884
commit b311255d96
6 changed files with 60 additions and 82 deletions
@@ -52,8 +52,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
private JetCoreEnvironment environmentWithMockJdk = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS);
private JetCoreEnvironment environmentWithFullJdk = JetTestUtils.createEnvironmentWithFullJdk(myTestRootDisposable);
private JetCoreEnvironment environmentWithFullJdkAndJUnit;
private final Pattern packagePattern = Pattern.compile("package (.*)");
private final List<String> generatedTestNames = Lists.newArrayList();
@@ -64,16 +63,6 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
private CodegenTestsOnAndroidGenerator(PathManager pathManager) {
this.pathManager = pathManager;
File junitJar = new File("libraries/lib/junit-4.9.jar");
if (!junitJar.exists()) {
throw new AssertionError();
}
environmentWithFullJdkAndJUnit = new JetCoreEnvironment(myTestRootDisposable, JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.ALL, TestJdkKind.FULL_JDK, JetTestUtils.getAnnotationsJar(), junitJar));
}
private void generateOutputFiles() throws Throwable {
@@ -130,7 +119,6 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
Assert.assertNotNull("Folder with testData is empty: " + dir.getAbsolutePath(), files);
Set<String> excludedFiles = SpecialFiles.getExcludedFiles();
Set<String> filesCompiledWithoutStdLib = SpecialFiles.getFilesCompiledWithoutStdLib();
Set<String> filesCompiledWithJUnit = SpecialFiles.getFilesCompiledWithJUnit();
for (File file : files) {
if (excludedFiles.contains(file.getName())) {
continue;
@@ -149,9 +137,6 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
if (filesCompiledWithoutStdLib.contains(file.getName())) {
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithMockJdk);
}
else if (filesCompiledWithJUnit.contains(file.getName())) {
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdkAndJUnit);
}
else {
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdk);
}
@@ -24,19 +24,13 @@ import java.util.Set;
public class SpecialFiles {
private static final Set<String> excludedFiles = Sets.newHashSet();
private static final Set<String> filesCompiledWithoutStdLib = Sets.newHashSet();
private static final Set<String> filesCompiledWithJUnit = Sets.newHashSet();
static {
fillExcludedFiles();
fillFilesCompiledWithoutStdLib();
fillFilesCompiledWithJUnit();
}
public static Set<String> getFilesCompiledWithJUnit() {
return filesCompiledWithJUnit;
}
public static Set<String> getExcludedFiles() {
return excludedFiles;
}
@@ -45,10 +39,6 @@ public class SpecialFiles {
return filesCompiledWithoutStdLib;
}
private static void fillFilesCompiledWithJUnit() {
filesCompiledWithJUnit.add("kt2334.kt");
}
private static void fillFilesCompiledWithoutStdLib() {
filesCompiledWithoutStdLib.add("kt1980.kt");
filesCompiledWithoutStdLib.add("kt1953_class.kt"); // Exception in code