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 Buildfile: build.xml
OUT OUT
OUT build: OUT build:
OUT [kotlinc] Compiling [[TestData]\hello.kt] => [[Temp]\hello.jar] OUT [kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
OUT [kotlinc] LOGGING: For source: [TestData]\hello.kt OUT [kotlinc] LOGGING: For source: [TestData]/hello.kt
OUT [kotlinc] LOGGING: Emitting: Hello/namespace.class OUT [kotlinc] LOGGING: Emitting: Hello/namespace.class
OUT OUT
OUT BUILD SUCCESSFUL OUT BUILD SUCCESSFUL
@@ -1,4 +1,4 @@
OUT ERROR: [TestData]\hello.kt: (4, 5) Unresolved reference: a OUT ERROR: [TestData]/hello.kt: (4, 5) Unresolved reference: a
OUT WARNING: [TestData]\hello.kt: (4, 5) The expression is unused OUT WARNING: [TestData]/hello.kt: (4, 5) The expression is unused
ERR exec() finished with COMPILATION_ERROR return code ERR exec() finished with COMPILATION_ERROR return code
Return code: 1 Return code: 1
@@ -113,10 +113,20 @@ public abstract class KotlinIntegrationTestBase {
return exitCode; 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) { protected String normalizeOutput(String content) {
return StringUtil.replace( content = replacePath(content, testDataDir, "[TestData]");
StringUtil.replace(content, testDataDir.getAbsolutePath(), "[TestData]", true), content = replacePath(content, tempDir, "[Temp]");
tempDir.getAbsolutePath(), "[Temp]", true); content = replacePath(content, getCompilerLib(), "[CompilerLib]");
return content;
} }
protected void check(String baseName, String content) throws IOException { protected void check(String baseName, String content) throws IOException {