Renamed and refactored test.
This commit is contained in:
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
|||||||
import com.intellij.testFramework.LightVirtualFile;
|
import com.intellij.testFramework.LightVirtualFile;
|
||||||
import com.intellij.util.Function;
|
import com.intellij.util.Function;
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.codegen.PackageCodegen;
|
import org.jetbrains.jet.codegen.PackageCodegen;
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
import org.jetbrains.jps.builders.BuildResult;
|
import org.jetbrains.jps.builders.BuildResult;
|
||||||
@@ -189,19 +190,14 @@ public class KotlinJpsBuildTest extends AbstractKotlinJpsBuildTestCase {
|
|||||||
doTest();
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCircularDependenciesWithKotlinFilesDifferentPackages() {
|
public void testCircularDependenciesDifferentPackages() {
|
||||||
initProject();
|
initProject();
|
||||||
BuildResult result = makeAll();
|
BuildResult result = makeAll();
|
||||||
|
|
||||||
// Check that outputs are located properly
|
// Check that outputs are located properly
|
||||||
for (JpsModule module : myProject.getModules()) {
|
assertFilesExistInOutput(findModule("module2"), "kt1/Kt1Package.class");
|
||||||
if (module.getName().equals("module2")) {
|
assertFilesExistInOutput(findModule("kotlinProject"), "kt2/Kt2Package.class");
|
||||||
assertFilesExistInOutput(module, "kt1/Kt1Package.class");
|
|
||||||
}
|
|
||||||
if (module.getName().equals("kotlinProject")) {
|
|
||||||
assertFilesExistInOutput(module, "kt2/Kt2Package.class");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result.assertSuccessful();
|
result.assertSuccessful();
|
||||||
|
|
||||||
checkPackageDeletedFromOutputWhen(Operation.CHANGE, "kotlinProject", "src/kt2.kt", "kt2.Kt2Package");
|
checkPackageDeletedFromOutputWhen(Operation.CHANGE, "kotlinProject", "src/kt2.kt", "kt2.Kt2Package");
|
||||||
@@ -216,16 +212,24 @@ public class KotlinJpsBuildTest extends AbstractKotlinJpsBuildTestCase {
|
|||||||
public boolean value(JpsModule module) {
|
public boolean value(JpsModule module) {
|
||||||
return module.getName().equals("module2");
|
return module.getName().equals("module2");
|
||||||
}
|
}
|
||||||
}), true);
|
}), true
|
||||||
|
);
|
||||||
makeAll().assertSuccessful();
|
makeAll().assertSuccessful();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JpsModule findModule(@NotNull String name) {
|
||||||
|
for (JpsModule module : myProject.getModules()) {
|
||||||
|
if (module.getName().equals(name)) {
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("Couldn't find module " + name);
|
||||||
|
}
|
||||||
|
|
||||||
private static void assertFilesExistInOutput(JpsModule module, String... relativePaths) {
|
private static void assertFilesExistInOutput(JpsModule module, String... relativePaths) {
|
||||||
String outputUrl = JpsJavaExtensionService.getInstance().getOutputUrl(module, false);
|
|
||||||
assertNotNull(outputUrl);
|
|
||||||
File outputDir = new File(JpsPathUtil.urlToPath(outputUrl));
|
|
||||||
for (String path : relativePaths) {
|
for (String path : relativePaths) {
|
||||||
File outputFile = new File(outputDir, path);
|
File outputFile = findFileInOutputDir(module, path);
|
||||||
assertTrue("Output not written: " +
|
assertTrue("Output not written: " +
|
||||||
outputFile.getAbsolutePath() +
|
outputFile.getAbsolutePath() +
|
||||||
"\n Directory contents: \n" +
|
"\n Directory contents: \n" +
|
||||||
@@ -234,6 +238,13 @@ public class KotlinJpsBuildTest extends AbstractKotlinJpsBuildTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static File findFileInOutputDir(JpsModule module, String relativePath) {
|
||||||
|
String outputUrl = JpsJavaExtensionService.getInstance().getOutputUrl(module, false);
|
||||||
|
assertNotNull(outputUrl);
|
||||||
|
File outputDir = new File(JpsPathUtil.urlToPath(outputUrl));
|
||||||
|
return new File(outputDir, relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
private void checkExcludesNotAffectedToOutput(String module, String... excludeRelativePaths) {
|
private void checkExcludesNotAffectedToOutput(String module, String... excludeRelativePaths) {
|
||||||
for (String path : excludeRelativePaths) {
|
for (String path : excludeRelativePaths) {
|
||||||
checkClassesDeletedFromOutputWhen(Operation.CHANGE, module, path, NOTHING);
|
checkClassesDeletedFromOutputWhen(Operation.CHANGE, module, path, NOTHING);
|
||||||
@@ -246,7 +257,7 @@ public class KotlinJpsBuildTest extends AbstractKotlinJpsBuildTestCase {
|
|||||||
File outputDir = new File(JpsPathUtil.urlToPath(outputUrl));
|
File outputDir = new File(JpsPathUtil.urlToPath(outputUrl));
|
||||||
for (String path : relativePaths) {
|
for (String path : relativePaths) {
|
||||||
File outputFile = new File(outputDir, path);
|
File outputFile = new File(outputDir, path);
|
||||||
assertFalse("Output directory \"" + outputFile.getAbsolutePath() + "\" contains \"" + path + "\"",
|
assertFalse("Output directory \"" + outputFile.getAbsolutePath() + "\" contains \"" + path + "\"",
|
||||||
outputFile.exists());
|
outputFile.exists());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user