Add test for issue KT-23582
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
$TESTDATA_DIR$/separateModules/sepModule1.kt
|
||||||
|
-meta-info
|
||||||
|
-output
|
||||||
|
$TEMP_DIR$/m1/m.js
|
||||||
|
---
|
||||||
|
$TESTDATA_DIR$/separateModules/sepModule2.kt
|
||||||
|
-libraries
|
||||||
|
$TEMP_DIR$/m1
|
||||||
|
-output
|
||||||
|
$TEMP_DIR$/m2/m.js
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
warning: module "m" depends from module with the same name
|
||||||
|
OK
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
// NOT_CONTAINS: m2/m.js, foo(bar$lambda);
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
$TESTDATA_DIR$/separateModules/sepModule3.kt
|
||||||
|
-meta-info
|
||||||
|
-output
|
||||||
|
$TEMP_DIR$/m3/m.js
|
||||||
|
---
|
||||||
|
$TESTDATA_DIR$/separateModules/sepModule4.kt
|
||||||
|
-libraries
|
||||||
|
$TEMP_DIR$/m3
|
||||||
|
-output
|
||||||
|
$TEMP_DIR$/m4/m.js
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
warning: module "m" depends from module with the same name
|
||||||
|
OK
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
// NOT_CONTAINS: m4/m.js, foofaa();
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package m1
|
||||||
|
|
||||||
|
inline fun foo(action: () -> Int): Int {
|
||||||
|
return action()
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package m2
|
||||||
|
|
||||||
|
import m1.*
|
||||||
|
|
||||||
|
fun bar(): Int {
|
||||||
|
foo { return 100 }
|
||||||
|
return -99
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (bar() == 100) return "OK"
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package m3
|
||||||
|
|
||||||
|
|
||||||
|
fun foofaa(): Unit { }
|
||||||
|
|
||||||
|
inline fun foo(action: () -> Int): Int {
|
||||||
|
foofaa()
|
||||||
|
return action()
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package m4
|
||||||
|
|
||||||
|
import m3.*
|
||||||
|
|
||||||
|
inline fun foo(action: () -> Int): Int {
|
||||||
|
return action()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar(): Int {
|
||||||
|
foo { return 100 }
|
||||||
|
return -99
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (bar() == 100) return "OK"
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
@@ -143,6 +143,26 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> notContainsTextList = InTextDirectivesUtils.findLinesWithPrefixesRemoved(content, "// NOT_CONTAINS: ");
|
||||||
|
for (String notContainsSpec : notContainsTextList) {
|
||||||
|
String[] parts = notContainsSpec.split(",", 2);
|
||||||
|
String fileName = parts[0].trim();
|
||||||
|
String contentToSearch = parts[1].trim();
|
||||||
|
File file = checkedPathToFile(fileName, argsFilePath);
|
||||||
|
if (!file.exists()) {
|
||||||
|
diagnostics.add("File does not exist: " + fileName);
|
||||||
|
}
|
||||||
|
else if (file.isDirectory()) {
|
||||||
|
diagnostics.add("File is a directory: " + fileName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
String text = FilesKt.readText(file, Charsets.UTF_8);
|
||||||
|
if (text.contains(contentToSearch)) {
|
||||||
|
diagnostics.add("File " + fileName + " contains string: " + contentToSearch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!diagnostics.isEmpty()) {
|
if (!diagnostics.isEmpty()) {
|
||||||
diagnostics.add(0, diagnostics.size() + " problem(s) found:");
|
diagnostics.add(0, diagnostics.size() + " problem(s) found:");
|
||||||
Assert.fail(StringsKt.join(diagnostics, "\n"));
|
Assert.fail(StringsKt.join(diagnostics, "\n"));
|
||||||
|
|||||||
@@ -684,6 +684,18 @@ public class CliTestGenerated extends AbstractCliTest {
|
|||||||
doJsTest(fileName);
|
doJsTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("modulesWithSameNames.args")
|
||||||
|
public void testModulesWithSameNames() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/modulesWithSameNames.args");
|
||||||
|
doJsTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("modulesWithSameNamesAndFunc.args")
|
||||||
|
public void testModulesWithSameNamesAndFunc() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/modulesWithSameNamesAndFunc.args");
|
||||||
|
doJsTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nonExistingKotlinHome.args")
|
@TestMetadata("nonExistingKotlinHome.args")
|
||||||
public void testNonExistingKotlinHome() throws Exception {
|
public void testNonExistingKotlinHome() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/nonExistingKotlinHome.args");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/js/nonExistingKotlinHome.args");
|
||||||
|
|||||||
Reference in New Issue
Block a user