tests for KT-7618 Compiling Maven project targeting JS fails when no source file present

This commit is contained in:
Michael Nedzelsky
2015-06-11 00:56:27 +03:00
parent dd60c7b79f
commit 744e760444
14 changed files with 87 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
$TEMP_DIR$
-no-stdlib
-output
$TESTDATA_DIR$
+2
View File
@@ -0,0 +1,2 @@
ERROR: No source files
COMPILATION_ERROR
+4
View File
@@ -0,0 +1,4 @@
not/existing/path
-no-stdlib
-output
$TESTDATA_DIR$
+2
View File
@@ -0,0 +1,2 @@
ERROR: Source file or directory not found: not/existing/path
COMPILATION_ERROR
+3
View File
@@ -0,0 +1,3 @@
$TEMP_DIR$
-d
$TEMP_DIR$
+2
View File
@@ -0,0 +1,2 @@
ERROR: No source files
COMPILATION_ERROR
@@ -4,7 +4,6 @@ Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 1 source file to [Temp]/classes
[javac] Compiling [[TestData]] => [[Temp]/classes]
[javac] Running javac...
[javac] [TestData]/J.java:3: package kotlin does not exist
[javac] import kotlin.Unit;
@@ -0,0 +1,5 @@
package test;
import kotlin.Unit;
public class J {}
@@ -0,0 +1,12 @@
OUT:
Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 1 source file to [Temp]/classes
[javac] Running javac...
BUILD SUCCESSFUL
Total time: [time]
Return code: 0
@@ -0,0 +1,10 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<mkdir dir="${temp}/classes"/>
<javac srcdir="${test.data}" destdir="${temp}/classes" includeantruntime="false">
<withKotlin/>
</javac>
</target>
</project>
@@ -67,6 +67,12 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
doJvmTest(fileName);
}
@TestMetadata("emptySources.args")
public void testEmptySources() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/emptySources.args");
doJvmTest(fileName);
}
@TestMetadata("extraHelp.args")
public void testExtraHelp() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/extraHelp.args");
@@ -214,6 +220,12 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
doJsTest(fileName);
}
@TestMetadata("emptySources.args")
public void testEmptySources() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/emptySources.args");
doJsTest(fileName);
}
@TestMetadata("inlineCycle.args")
public void testInlineCycle() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/inlineCycle.args");
@@ -238,6 +250,12 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
doJsTest(fileName);
}
@TestMetadata("nonExistingSourcePath.args")
public void testNonExistingSourcePath() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/nonExistingSourcePath.args");
doJsTest(fileName);
}
@TestMetadata("notValidLibraryDir.args")
public void testNotValidLibraryDir() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/notValidLibraryDir.args");
@@ -37,6 +37,20 @@ public class K2JsCliTest extends CliBaseTest {
Assert.assertFalse(new File(tmpdir.getTmpDir(), "out.js").exists());
}
@Test
public void nonExistingSourcePath() throws Exception {
executeCompilerCompareOutputJS();
Assert.assertFalse(new File(tmpdir.getTmpDir(), "out.js").exists());
}
@Test
public void emptySources() throws Exception {
executeCompilerCompareOutputJS();
Assert.assertFalse(new File(tmpdir.getTmpDir(), "out.js").exists());
}
@Test
public void outputPrefixFileNotFound() throws Exception {
executeCompilerCompareOutputJS();
@@ -47,6 +47,11 @@ public class K2JvmCliTest extends CliBaseTest {
executeCompilerCompareOutputJVM();
}
@Test
public void emptySources() throws Exception {
executeCompilerCompareOutputJVM();
}
@Test
public void classpath() throws Exception {
executeCompilerCompareOutputJVM();
@@ -65,6 +65,12 @@ public class AntTaskTestGenerated extends AbstractAntTaskTest {
doTest(fileName);
}
@TestMetadata("stdlibForJavacWithNoKotlin")
public void testStdlibForJavacWithNoKotlin() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/integration/ant/jvm/stdlibForJavacWithNoKotlin/");
doTest(fileName);
}
@TestMetadata("suppressWarnings")
public void testSuppressWarnings() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/integration/ant/jvm/suppressWarnings/");