From 04ccca8adcc709ab7fbe66be8465e334beafa1eb Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 8 Feb 2016 22:06:55 +0530 Subject: [PATCH] CLI tests: convert to generated --- .../jetbrains/kotlin/cli/AbstractCliTest.java | 45 +- .../cli/AbstractKotlincExecutableTest.java | 11 +- .../kotlin/cli/CliTestGenerated.java | 409 ++++++++++++++++++ .../jetbrains/kotlin/cli/js/K2JsCliTest.java | 81 ---- .../kotlin/cli/jvm/K2JvmCliTest.java | 105 ----- .../kotlin/generators/tests/GenerateTests.kt | 6 + .../idea/quickfix/QuickFixTestGenerated.java | 1 + 7 files changed, 441 insertions(+), 217 deletions(-) create mode 100644 compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java delete mode 100644 compiler/tests/org/jetbrains/kotlin/cli/js/K2JsCliTest.java delete mode 100644 compiler/tests/org/jetbrains/kotlin/cli/jvm/K2JvmCliTest.java diff --git a/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java b/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java index 7e1cae4f756..33e3e64ae93 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java @@ -17,10 +17,10 @@ package org.jetbrains.kotlin.cli; import com.intellij.util.ArrayUtil; -import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; import kotlin.Pair; +import kotlin.collections.CollectionsKt; import kotlin.io.FilesKt; +import kotlin.jvm.functions.Function1; import kotlin.text.Charsets; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.cli.common.CLICompiler; @@ -46,9 +46,6 @@ import java.util.ArrayList; import java.util.List; public abstract class AbstractCliTest extends TestCaseWithTmpdir { - static final String JS_TEST_DATA = "compiler/testData/cli/js"; - static final String JVM_TEST_DATA = "compiler/testData/cli/jvm"; - @NotNull public static Pair executeCompilerGrabOutput(@NotNull CLICompiler compiler, @NotNull List args) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -88,17 +85,16 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir { return normalizedOutputWithoutExitCode + exitCode; } - private void executeCompilerCompareOutput(@NotNull CLICompiler compiler, @NotNull String testDataDir) throws Exception { + private void doTest(@NotNull String fileName, @NotNull CLICompiler compiler) throws Exception { System.setProperty("java.awt.headless", "true"); - String testMethodName = getTestName(true); - Pair outputAndExitCode = - executeCompilerGrabOutput(compiler, readArgs(testDataDir + "/" + testMethodName + ".args", testDataDir, - tmpdir.getPath())); - String actual = getNormalizedCompilerOutput(outputAndExitCode.getFirst(), outputAndExitCode.getSecond(), testDataDir); + Pair outputAndExitCode = executeCompilerGrabOutput(compiler, readArgs(fileName, tmpdir.getPath())); + String actual = + getNormalizedCompilerOutput(outputAndExitCode.getFirst(), outputAndExitCode.getSecond(), new File(fileName).getParent()); - KotlinTestUtils.assertEqualsToFile(new File(testDataDir + "/" + testMethodName + ".out"), actual); + File outFile = new File(fileName.replaceFirst("\\.args$", ".out")); + KotlinTestUtils.assertEqualsToFile(outFile, actual); - File additionalTestConfig = new File(testDataDir + "/" + testMethodName + ".test"); + File additionalTestConfig = new File(fileName.replaceFirst("\\.args$", ".test")); if (additionalTestConfig.exists()) { doTestAdditionalChecks(additionalTestConfig); } @@ -134,20 +130,17 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir { } @NotNull - static List readArgs( - @NotNull String argsFilePath, - @NotNull final String testDataDir, - @NotNull final String tempDir - ) throws IOException { + static List readArgs(@NotNull final String argsFilePath, @NotNull final String tempDir) throws IOException { List lines = FilesKt.readLines(new File(argsFilePath), Charsets.UTF_8); - return ContainerUtil.mapNotNull(lines, new Function() { + return CollectionsKt.mapNotNull(lines, new Function1() { @Override - public String fun(String arg) { + public String invoke(String arg) { if (arg.isEmpty()) { return null; } - // Do not replace : after \ (used in compiler plugin tests) + + // Do not replace ':' after '\' (used in compiler plugin tests) String argsWithColonsReplaced = arg .replace("\\:", "$COLON$") .replace(":", File.pathSeparator) @@ -155,16 +148,16 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir { return argsWithColonsReplaced .replace("$TEMP_DIR$", tempDir) - .replace("$TESTDATA_DIR$", testDataDir); + .replace("$TESTDATA_DIR$", new File(argsFilePath).getParent()); } }); } - protected void executeCompilerCompareOutputJVM() throws Exception { - executeCompilerCompareOutput(new K2JVMCompiler(), JVM_TEST_DATA); + protected void doJvmTest(@NotNull String fileName) throws Exception { + doTest(fileName, new K2JVMCompiler()); } - protected void executeCompilerCompareOutputJS() throws Exception { - executeCompilerCompareOutput(new K2JSCompiler(), JS_TEST_DATA); + protected void doJsTest(@NotNull String fileName) throws Exception { + doTest(fileName, new K2JSCompiler()); } } diff --git a/compiler/tests/org/jetbrains/kotlin/cli/AbstractKotlincExecutableTest.java b/compiler/tests/org/jetbrains/kotlin/cli/AbstractKotlincExecutableTest.java index 957d3394878..d26fbb183fe 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/AbstractKotlincExecutableTest.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/AbstractKotlincExecutableTest.java @@ -29,12 +29,12 @@ import java.io.File; import java.util.List; public abstract class AbstractKotlincExecutableTest extends TestCaseWithTmpdir { - private void doTest(@NotNull String argsFilePath, @NotNull String executableName, @NotNull String testDataDir) throws Exception { + private void doTest(@NotNull String argsFilePath, @NotNull String executableName) throws Exception { String executableFileName = SystemInfo.isWindows ? executableName + ".bat" : executableName; File kotlincFile = new File(PathUtil.getKotlinPathsForDistDirectory().getHomePath(), "bin/" + executableFileName); assertTrue("kotlinc executable not found, probably you need to invoke 'dist' Ant target: " + kotlincFile.getAbsolutePath(), kotlincFile.exists()); - List args = AbstractCliTest.readArgs(argsFilePath, testDataDir, tmpdir.getAbsolutePath()); + List args = AbstractCliTest.readArgs(argsFilePath, tmpdir.getAbsolutePath()); args.add(0, kotlincFile.getAbsolutePath()); ProcessOutput processOutput = ExecUtil.execAndGetOutput(args, null); @@ -42,7 +42,8 @@ public abstract class AbstractKotlincExecutableTest extends TestCaseWithTmpdir { String stderr = processOutput.getStderr(); int exitCode = processOutput.getExitCode(); - String normalizedOutput = AbstractCliTest.getNormalizedCompilerOutput(stderr, ExitCode.values()[exitCode], testDataDir); + String normalizedOutput = + AbstractCliTest.getNormalizedCompilerOutput(stderr, ExitCode.values()[exitCode], new File(argsFilePath).getParent()); File outFile = new File(argsFilePath.replace(".args", ".out")); try { @@ -58,10 +59,10 @@ public abstract class AbstractKotlincExecutableTest extends TestCaseWithTmpdir { } protected void doJvmTest(@NotNull String argsFilePath) throws Exception { - doTest(argsFilePath, "kotlinc-jvm", AbstractCliTest.JVM_TEST_DATA); + doTest(argsFilePath, "kotlinc-jvm"); } protected void doJsTest(@NotNull String argsFilePath) throws Exception { - doTest(argsFilePath, "kotlinc-js", AbstractCliTest.JS_TEST_DATA); + doTest(argsFilePath, "kotlinc-js"); } } diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java new file mode 100644 index 00000000000..2cdfec4489d --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -0,0 +1,409 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.cli; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@RunWith(JUnit3RunnerWithInners.class) +public class CliTestGenerated extends AbstractCliTest { + @TestMetadata("compiler/testData/cli/jvm") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jvm extends AbstractCliTest { + public void testAllFilesPresentInJvm() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cli/jvm"), Pattern.compile("^(.+)\\.args$"), false); + } + + @TestMetadata("classAndFileClassClash.args") + public void testClassAndFileClassClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/classAndFileClassClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("classAndOtherFileClassClash.args") + public void testClassAndOtherFileClassClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/classAndOtherFileClassClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("classAndPartClash.args") + public void testClassAndPartClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/classAndPartClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("classAndTraitClash.args") + public void testClassAndTraitClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/classAndTraitClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("classpath.args") + public void testClasspath() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/classpath.args"); + doJvmTest(fileName); + } + + @TestMetadata("conflictingOverloads.args") + public void testConflictingOverloads() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/conflictingOverloads.args"); + doJvmTest(fileName); + } + + @TestMetadata("conflictingRuntimeVersion.args") + public void testConflictingRuntimeVersion() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/conflictingRuntimeVersion.args"); + doJvmTest(fileName); + } + + @TestMetadata("conflictingRuntimeVersionNoError.args") + public void testConflictingRuntimeVersionNoError() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/conflictingRuntimeVersionNoError.args"); + doJvmTest(fileName); + } + + @TestMetadata("diagnosticsOrder.args") + public void testDiagnosticsOrder() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/diagnosticsOrder.args"); + doJvmTest(fileName); + } + + @TestMetadata("duplicateSources.args") + public void testDuplicateSources() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/duplicateSources.args"); + doJvmTest(fileName); + } + + @TestMetadata("duplicateSourcesInModule.args") + public void testDuplicateSourcesInModule() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/duplicateSourcesInModule.args"); + doJvmTest(fileName); + } + + @TestMetadata("emptySources.args") + public void testEmptySources() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/emptySources.args"); + doJvmTest(fileName); + } + + @TestMetadata("extraHelp.args") + public void testExtraHelp() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/extraHelp.args"); + doJvmTest(fileName); + } + + @TestMetadata("fileClassAndMultifileClassClash.args") + public void testFileClassAndMultifileClassClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/fileClassAndMultifileClassClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("fileClassAndTImplClash.args") + public void testFileClassAndTImplClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/fileClassAndTImplClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("fileClassClashMultipleFiles.args") + public void testFileClassClashMultipleFiles() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/fileClassClashMultipleFiles.args"); + doJvmTest(fileName); + } + + @TestMetadata("help.args") + public void testHelp() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/help.args"); + doJvmTest(fileName); + } + + @TestMetadata("inlineCycle.args") + public void testInlineCycle() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/inlineCycle.args"); + doJvmTest(fileName); + } + + @TestMetadata("kotlinPackage.args") + public void testKotlinPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/kotlinPackage.args"); + doJvmTest(fileName); + } + + @TestMetadata("multipleTextRangesInDiagnosticsOrder.args") + public void testMultipleTextRangesInDiagnosticsOrder() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/multipleTextRangesInDiagnosticsOrder.args"); + doJvmTest(fileName); + } + + @TestMetadata("nonExistingClassPathAndAnnotationsPath.args") + public void testNonExistingClassPathAndAnnotationsPath() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/nonExistingClassPathAndAnnotationsPath.args"); + doJvmTest(fileName); + } + + @TestMetadata("nonExistingSourcePath.args") + public void testNonExistingSourcePath() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/nonExistingSourcePath.args"); + doJvmTest(fileName); + } + + @TestMetadata("nonLocalDisabled.args") + public void testNonLocalDisabled() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/nonLocalDisabled.args"); + doJvmTest(fileName); + } + + @TestMetadata("nonexistentPathInModule.args") + public void testNonexistentPathInModule() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/nonexistentPathInModule.args"); + doJvmTest(fileName); + } + + @TestMetadata("nonexistentScript.args") + public void testNonexistentScript() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/nonexistentScript.args"); + doJvmTest(fileName); + } + + @TestMetadata("pluginSimple.args") + public void testPluginSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/pluginSimple.args"); + doJvmTest(fileName); + } + + @TestMetadata("pluginSimpleUsage.args") + public void testPluginSimpleUsage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/pluginSimpleUsage.args"); + doJvmTest(fileName); + } + + @TestMetadata("sanitized-name.clash.args") + public void testSanitized_name_clash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/sanitized-name.clash.args"); + doJvmTest(fileName); + } + + @TestMetadata("signatureClash.args") + public void testSignatureClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/signatureClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("simple.args") + public void testSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/simple.args"); + doJvmTest(fileName); + } + + @TestMetadata("suppressAllWarningsJvm.args") + public void testSuppressAllWarningsJvm() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/suppressAllWarningsJvm.args"); + doJvmTest(fileName); + } + + @TestMetadata("syntheticAccessorForPropertiesSignatureClash.args") + public void testSyntheticAccessorForPropertiesSignatureClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("syntheticAccessorPropertyAndFunSignatureClash.args") + public void testSyntheticAccessorPropertyAndFunSignatureClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("syntheticAccessorSignatureClash.args") + public void testSyntheticAccessorSignatureClash() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorSignatureClash.args"); + doJvmTest(fileName); + } + + @TestMetadata("version.args") + public void testVersion() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/version.args"); + doJvmTest(fileName); + } + + @TestMetadata("warningsInDummy.args") + public void testWarningsInDummy() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/warningsInDummy.args"); + doJvmTest(fileName); + } + + @TestMetadata("wrongAbiVersion.args") + public void testWrongAbiVersion() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/wrongAbiVersion.args"); + doJvmTest(fileName); + } + + @TestMetadata("wrongAbiVersionNoErrors.args") + public void testWrongAbiVersionNoErrors() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/wrongAbiVersionNoErrors.args"); + doJvmTest(fileName); + } + + @TestMetadata("wrongArgument.args") + public void testWrongArgument() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/wrongArgument.args"); + doJvmTest(fileName); + } + + @TestMetadata("wrongScriptWithNoSource.args") + public void testWrongScriptWithNoSource() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/wrongScriptWithNoSource.args"); + doJvmTest(fileName); + } + } + + @TestMetadata("compiler/testData/cli/js") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Js extends AbstractCliTest { + public void testAllFilesPresentInJs() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cli/js"), Pattern.compile("^(.+)\\.args$"), false); + } + + @TestMetadata("createKjsm.args") + public void testCreateKjsm() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/createKjsm.args"); + doJsTest(fileName); + } + + @TestMetadata("createMetadata.args") + public void testCreateMetadata() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/createMetadata.args"); + doJsTest(fileName); + } + + @TestMetadata("diagnosticForClassLiteral.args") + public void testDiagnosticForClassLiteral() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/diagnosticForClassLiteral.args"); + doJsTest(fileName); + } + + @TestMetadata("diagnosticWhenReferenceToBuiltinsMember.args") + public void testDiagnosticWhenReferenceToBuiltinsMember() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/diagnosticWhenReferenceToBuiltinsMember.args"); + doJsTest(fileName); + } + + @TestMetadata("emptySources.args") + public void testEmptySources() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/emptySources.args"); + doJsTest(fileName); + } + + @TestMetadata("inlineCycle.args") + public void testInlineCycle() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/inlineCycle.args"); + doJsTest(fileName); + } + + @TestMetadata("jsExtraHelp.args") + public void testJsExtraHelp() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/jsExtraHelp.args"); + doJsTest(fileName); + } + + @TestMetadata("jsHelp.args") + public void testJsHelp() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/jsHelp.args"); + doJsTest(fileName); + } + + @TestMetadata("libraryDirNotFound.args") + public void testLibraryDirNotFound() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/libraryDirNotFound.args"); + doJsTest(fileName); + } + + @TestMetadata("nonExistingSourcePath.args") + public void testNonExistingSourcePath() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/nonExistingSourcePath.args"); + doJsTest(fileName); + } + + @TestMetadata("notValidLibraryDir.args") + public void testNotValidLibraryDir() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/notValidLibraryDir.args"); + doJsTest(fileName); + } + + @TestMetadata("outputIsDirectory.args") + public void testOutputIsDirectory() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/outputIsDirectory.args"); + doJsTest(fileName); + } + + @TestMetadata("outputPostfixFileNotFound.args") + public void testOutputPostfixFileNotFound() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/outputPostfixFileNotFound.args"); + doJsTest(fileName); + } + + @TestMetadata("outputPrefixFileNotFound.args") + public void testOutputPrefixFileNotFound() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/outputPrefixFileNotFound.args"); + doJsTest(fileName); + } + + @TestMetadata("simple2js.args") + public void testSimple2js() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/simple2js.args"); + doJsTest(fileName); + } + + @TestMetadata("suppressAllWarningsJS.args") + public void testSuppressAllWarningsJS() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/suppressAllWarningsJS.args"); + doJsTest(fileName); + } + + @TestMetadata("version.args") + public void testVersion() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/version.args"); + doJsTest(fileName); + } + + @TestMetadata("withFolderAsLib.args") + public void testWithFolderAsLib() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/withFolderAsLib.args"); + doJsTest(fileName); + } + + @TestMetadata("withLib.args") + public void testWithLib() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/withLib.args"); + doJsTest(fileName); + } + + @TestMetadata("wrongAbiVersion.args") + public void testWrongAbiVersion() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/wrongAbiVersion.args"); + doJsTest(fileName); + } + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/cli/js/K2JsCliTest.java b/compiler/tests/org/jetbrains/kotlin/cli/js/K2JsCliTest.java deleted file mode 100644 index 4d574ff9769..00000000000 --- a/compiler/tests/org/jetbrains/kotlin/cli/js/K2JsCliTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.cli.js; - -import org.jetbrains.kotlin.cli.AbstractCliTest; - -public class K2JsCliTest extends AbstractCliTest { - public void testSimple2js() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testOutputIsDirectory() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testNonExistingSourcePath() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testEmptySources() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testOutputPrefixFileNotFound() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testOutputPostfixFileNotFound() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testWrongAbiVersion() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testJsHelp() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testWithLib() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testWithFolderAsLib() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testCreateMetadata() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testCreateKjsm() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testLibraryDirNotFound() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testNotValidLibraryDir() throws Exception { - executeCompilerCompareOutputJS(); - } - - public void testSuppressAllWarningsJS() throws Exception { - executeCompilerCompareOutputJS(); - } -} diff --git a/compiler/tests/org/jetbrains/kotlin/cli/jvm/K2JvmCliTest.java b/compiler/tests/org/jetbrains/kotlin/cli/jvm/K2JvmCliTest.java deleted file mode 100644 index b39af81bf6b..00000000000 --- a/compiler/tests/org/jetbrains/kotlin/cli/jvm/K2JvmCliTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.cli.jvm; - -import org.jetbrains.kotlin.cli.AbstractCliTest; - -public class K2JvmCliTest extends AbstractCliTest { - public void testWrongAbiVersion() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testWrongAbiVersionNoErrors() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testNonExistingClassPathAndAnnotationsPath() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testNonExistingSourcePath() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testEmptySources() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testClasspath() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testSignatureClash() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testConflictingOverloads() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testWarningsInDummy() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testHelp() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testWrongArgument() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testSimple() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testDuplicateSources() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testDuplicateSourcesInModule() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testNonexistentPathInModule() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testNonexistentScript() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testDiagnosticsOrder() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testMultipleTextRangesInDiagnosticsOrder() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testSuppressAllWarningsJvm() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testPluginSimple() throws Exception { - executeCompilerCompareOutputJVM(); - } - - public void testPluginSimpleUsage() throws Exception { - executeCompilerCompareOutputJVM(); - } -} diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index bde4f1e5932..8c5f389b124 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.cfg.AbstractControlFlowTest import org.jetbrains.kotlin.cfg.AbstractDataFlowTest import org.jetbrains.kotlin.cfg.AbstractPseudoValueTest import org.jetbrains.kotlin.checkers.* +import org.jetbrains.kotlin.cli.AbstractCliTest import org.jetbrains.kotlin.cli.AbstractKotlincExecutableTest import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.codegen.defaultConstructor.AbstractDefaultArgumentsReflectionTest @@ -303,6 +304,11 @@ fun main(args: Array) { model("writeSignature") } + testClass() { + model("cli/jvm", extension = "args", testMethod = "doJvmTest", recursive = false) + model("cli/js", extension = "args", testMethod = "doJsTest", recursive = false) + } + testClass() { model("cli/jvm", extension = "args", testMethod = "doJvmTest", recursive = false) model("cli/js", extension = "args", testMethod = "doJsTest", recursive = false) diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index afa6e853953..6b4250a838f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -810,6 +810,7 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/changeSignature/removeUnusedParameter.kt"); doTest(fileName); } + } @TestMetadata("idea/testData/quickfix/checkArguments")