fix tests
This commit is contained in:
@@ -6,5 +6,5 @@ OUT [kotlinc] LOGGING: For source: [TestData]\hello.kt
|
||||
OUT [kotlinc] LOGGING: Emitting: Hello/namespace.class
|
||||
OUT
|
||||
OUT BUILD SUCCESSFUL
|
||||
OUT Total time: 2 seconds
|
||||
OUT Total time: [time]
|
||||
Return code: 0
|
||||
|
||||
@@ -31,6 +31,12 @@ public class AntTaskTest extends KotlinIntegrationTestBase {
|
||||
runJava("hello.run", "-cp", jar, "Hello.namespace");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String normalizeOutput(String content) {
|
||||
return super.normalizeOutput(content)
|
||||
.replaceAll("Total time: .+\n", "Total time: [time]\n");
|
||||
}
|
||||
|
||||
private int runAnt(String logName, String scriptName) throws Exception {
|
||||
return runJava(logName, "-jar", getAntHome() + File.separator + "lib" + File.separator + "ant-launcher.jar",
|
||||
"-Dkotlin.lib=" + getCompilerLib(),
|
||||
|
||||
@@ -48,6 +48,6 @@ public class CompilerSmokeTest extends KotlinIntegrationTestBase {
|
||||
public void compilationFailed() throws Exception {
|
||||
final String jar = tempDir.getAbsolutePath() + File.separator + "smoke.jar";
|
||||
|
||||
assertEquals("compilation failed", 0, runCompiler("hello.compile", "-src", "hello.kt", "-jar", jar));
|
||||
runCompiler("hello.compile", "-src", "hello.kt", "-jar", jar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,14 +113,17 @@ public abstract class KotlinIntegrationTestBase {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
protected String normalizeOutput(String content) {
|
||||
return StringUtil.replace(
|
||||
StringUtil.replace(content, testDataDir.getAbsolutePath(), "[TestData]", true),
|
||||
tempDir.getAbsolutePath(), "[Temp]", true);
|
||||
}
|
||||
|
||||
protected void check(String baseName, String content) throws IOException {
|
||||
final File actualFile = new File(testDataDir, baseName + ".actual");
|
||||
final File expectedFile = new File(testDataDir, baseName + ".expected");
|
||||
|
||||
final String normalizedContent =
|
||||
StringUtil.replace(
|
||||
StringUtil.replace(content, testDataDir.getAbsolutePath(), "[TestData]", true),
|
||||
tempDir.getAbsolutePath(), "[Temp]", true);
|
||||
final String normalizedContent = normalizeOutput(content);
|
||||
|
||||
if (!expectedFile.isFile()) {
|
||||
Files.write(normalizedContent, actualFile, Charsets.UTF_8);
|
||||
|
||||
Reference in New Issue
Block a user