Send compiler output to stderr instead of stdout

Test only stderr in kotlinc test now and move the '-script' test to integration
tests where both stdout and stderr is tested
This commit is contained in:
Alexander Udalov
2014-07-22 16:14:49 +04:00
parent 7e6b05554e
commit 5003a2f570
14 changed files with 26 additions and 41 deletions
@@ -42,14 +42,14 @@ public abstract class AbstractKotlincExecutableTest extends TestCaseWithTmpdir {
String stderr = processOutput.getStderr();
int exitCode = processOutput.getExitCode();
String normalizedOutput = CliBaseTest.getNormalizedCompilerOutput(stdout, ExitCode.values()[exitCode], testDataDir);
String normalizedOutput = CliBaseTest.getNormalizedCompilerOutput(stderr, ExitCode.values()[exitCode], testDataDir);
File outFile = new File(argsFilePath.replace(".args", ".out"));
try {
JetTestUtils.assertEqualsToFile(outFile, normalizedOutput);
}
catch (Exception e) {
System.err.println("exitcode " + exitCode);
System.err.println("exit code " + exitCode);
System.err.println("<stdout>" + stdout + "</stdout>");
System.err.println("<stderr>" + stderr + "</stderr>");
@@ -48,9 +48,9 @@ public class CliBaseTest {
@NotNull
private static Pair<String, ExitCode> executeCompilerGrabOutput(@NotNull CLICompiler<?> compiler, @NotNull List<String> args) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
PrintStream origOut = System.out;
PrintStream origErr = System.err;
try {
System.setOut(new PrintStream(bytes));
System.setErr(new PrintStream(bytes));
ExitCode exitCode = CLICompiler.doMainNoExit(compiler, ArrayUtil.toStringArray(args));
return Pair.create(bytes.toString("utf-8"), exitCode);
}
@@ -58,7 +58,7 @@ public class CliBaseTest {
throw UtilsPackage.rethrow(e);
}
finally {
System.setOut(origOut);
System.setErr(origErr);
}
}
@@ -16,9 +16,9 @@
package org.jetbrains.jet.cli;
import junit.framework.Assert;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
@@ -34,16 +34,6 @@ public class CliCommonTest extends CliBaseTest {
executeCompilerCompareOutputJVM();
}
@Test
public void printArguments() throws Exception {
executeCompilerCompareOutputJVM();
}
@Test
public void printArgumentsWithManyValue() throws Exception {
executeCompilerCompareOutputJS();
}
@Test
public void simple() throws Exception {
executeCompilerCompareOutputJVM();
@@ -79,11 +79,6 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
doJvmTest("compiler/testData/cli/jvm/printArguments.args");
}
@TestMetadata("script.args")
public void testScript() throws Exception {
doJvmTest("compiler/testData/cli/jvm/script.args");
}
@TestMetadata("signatureClash.args")
public void testSignatureClash() throws Exception {
doJvmTest("compiler/testData/cli/jvm/signatureClash.args");
@@ -16,10 +16,10 @@
package org.jetbrains.jet.cli.jvm;
import junit.framework.Assert;
import org.jetbrains.jet.cli.CliBaseTest;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
@@ -47,11 +47,6 @@ public class K2JvmCliTest extends CliBaseTest {
executeCompilerCompareOutputJVM();
}
@Test
public void script() throws Exception {
executeCompilerCompareOutputJVM();
}
@Test
public void classpath() throws Exception {
executeCompilerCompareOutputJVM();