integration tests: trying to be cross-platform

This commit is contained in:
Leonid Shalupov
2012-05-07 23:03:53 +04:00
parent a5a2bd9220
commit 428771d99d
3 changed files with 17 additions and 7 deletions
@@ -1,8 +1,8 @@
OUT Buildfile: build.xml
OUT
OUT build:
OUT [kotlinc] Compiling [[TestData]\hello.kt] => [[Temp]\hello.jar]
OUT [kotlinc] LOGGING: For source: [TestData]\hello.kt
OUT [kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
OUT [kotlinc] LOGGING: For source: [TestData]/hello.kt
OUT [kotlinc] LOGGING: Emitting: Hello/namespace.class
OUT
OUT BUILD SUCCESSFUL
@@ -1,4 +1,4 @@
OUT ERROR: [TestData]\hello.kt: (4, 5) Unresolved reference: a
OUT WARNING: [TestData]\hello.kt: (4, 5) The expression is unused
OUT ERROR: [TestData]/hello.kt: (4, 5) Unresolved reference: a
OUT WARNING: [TestData]/hello.kt: (4, 5) The expression is unused
ERR exec() finished with COMPILATION_ERROR return code
Return code: 1
@@ -113,10 +113,20 @@ public abstract class KotlinIntegrationTestBase {
return exitCode;
}
private static String replacePath(String content, File path, String pathId) {
final String absolutePath = path.getAbsolutePath();
return content
.replace(absolutePath + "/", pathId + "/")
.replace(absolutePath + "\\", pathId + "/")
.replace(absolutePath, pathId);
}
protected String normalizeOutput(String content) {
return StringUtil.replace(
StringUtil.replace(content, testDataDir.getAbsolutePath(), "[TestData]", true),
tempDir.getAbsolutePath(), "[Temp]", true);
content = replacePath(content, testDataDir, "[TestData]");
content = replacePath(content, tempDir, "[Temp]");
content = replacePath(content, getCompilerLib(), "[CompilerLib]");
return content;
}
protected void check(String baseName, String content) throws IOException {