From 428771d99d263115b55aeeb471a031d49cbfa617 Mon Sep 17 00:00:00 2001 From: Leonid Shalupov Date: Mon, 7 May 2012 23:03:53 +0400 Subject: [PATCH] integration tests: trying to be cross-platform --- .../data/antTaskJvm/build.log.expected | 4 ++-- .../compilationFailed/hello.compile.expected | 4 ++-- .../kotlin/KotlinIntegrationTestBase.java | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/compiler/integration-tests/data/antTaskJvm/build.log.expected b/compiler/integration-tests/data/antTaskJvm/build.log.expected index 98710f8f8c2..3f171971523 100644 --- a/compiler/integration-tests/data/antTaskJvm/build.log.expected +++ b/compiler/integration-tests/data/antTaskJvm/build.log.expected @@ -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 diff --git a/compiler/integration-tests/data/compilationFailed/hello.compile.expected b/compiler/integration-tests/data/compilationFailed/hello.compile.expected index 6319b1c5a44..4b0d95cb23a 100644 --- a/compiler/integration-tests/data/compilationFailed/hello.compile.expected +++ b/compiler/integration-tests/data/compilationFailed/hello.compile.expected @@ -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 diff --git a/compiler/integration-tests/src/org/jetbrains/kotlin/KotlinIntegrationTestBase.java b/compiler/integration-tests/src/org/jetbrains/kotlin/KotlinIntegrationTestBase.java index 0b33c0da0db..6bd46107cad 100644 --- a/compiler/integration-tests/src/org/jetbrains/kotlin/KotlinIntegrationTestBase.java +++ b/compiler/integration-tests/src/org/jetbrains/kotlin/KotlinIntegrationTestBase.java @@ -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 {