more tests for compiler
This commit is contained in:
committed by
Evgeny Gerashchenko
parent
0813e6bc1c
commit
a8cd11f0f9
@@ -17,9 +17,9 @@
|
||||
package org.jetbrains.jet.cli.jvm;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.cli.common.CLICompiler;
|
||||
import org.jetbrains.jet.cli.common.ExitCode;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler;
|
||||
import org.jetbrains.jet.lang.parsing.JetScriptDefinition;
|
||||
@@ -37,10 +37,8 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
@@ -57,9 +55,8 @@ public class CliTest {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
PrintStream origOut = System.out;
|
||||
try {
|
||||
// we change System.out because scripts ignore passed OutputStream and write to System.out
|
||||
System.setOut(new PrintStream(bytes));
|
||||
ExitCode exitCode = new K2JVMCompiler().exec(System.out, args);
|
||||
ExitCode exitCode = CLICompiler.doDoMain(new K2JVMCompiler(), args);
|
||||
return bytes.toString("utf-8") + exitCode + "\n";
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -115,7 +112,7 @@ public class CliTest {
|
||||
|
||||
@Test
|
||||
public void help() throws Exception {
|
||||
executeCompilerCompareOutput(new String[] {"--help"});
|
||||
executeCompilerCompareOutput(new String[] {"-help"});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -128,6 +125,17 @@ public class CliTest {
|
||||
executeCompilerCompareOutput(new String[]{ "-src", "compiler/testData/cli/ideTemplates.kt", "-output", tmpdir.getTmpDir().getPath()});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wrongArgument() {
|
||||
executeCompilerCompareOutput(new String[] { "-wrongArgument" });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void printArguments() {
|
||||
System.setProperty("kotlin.print.cmd.args", "true");
|
||||
executeCompilerCompareOutput(new String[] {"-script", "compiler/testData/cli/hello.ktscript"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScript() {
|
||||
LinkedList<AnalyzerScriptParameter> scriptParameters = new LinkedList<AnalyzerScriptParameter>();
|
||||
|
||||
Reference in New Issue
Block a user