[K/JS] Migrate invalidation tests to ES modules
This commit is contained in:
@@ -153,7 +153,7 @@ class ProjectInfoParser(infoFile: File) : InfoParser<ProjectInfo>(infoFile) {
|
|||||||
val libraries = mutableListOf<String>()
|
val libraries = mutableListOf<String>()
|
||||||
val steps = mutableListOf<ProjectInfo.ProjectBuildStep>()
|
val steps = mutableListOf<ProjectInfo.ProjectBuildStep>()
|
||||||
var muted = false
|
var muted = false
|
||||||
var moduleKind = ModuleKind.COMMON_JS
|
var moduleKind = ModuleKind.ES
|
||||||
|
|
||||||
loop { line ->
|
loop { line ->
|
||||||
lineCounter++
|
lineCounter++
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ abstract class AbstractInvalidationTest(private val targetBackend: TargetBackend
|
|||||||
|
|
||||||
private fun String.isAllowedKtFile() = endsWith(".kt") && !TEST_FILE_IGNORE_PATTERN.matches(this)
|
private fun String.isAllowedKtFile() = endsWith(".kt") && !TEST_FILE_IGNORE_PATTERN.matches(this)
|
||||||
|
|
||||||
private fun String.isAllowedJsFile() = endsWith(".js") && !TEST_FILE_IGNORE_PATTERN.matches(this)
|
private fun String.isAllowedJsFile() = (endsWith(".js") || endsWith(".mjs")) && !TEST_FILE_IGNORE_PATTERN.matches(this)
|
||||||
|
|
||||||
protected fun File.filteredKtFiles(): Collection<File> {
|
protected fun File.filteredKtFiles(): Collection<File> {
|
||||||
assert(isDirectory && exists())
|
assert(isDirectory && exists())
|
||||||
|
|||||||
Generated
-6
@@ -115,12 +115,6 @@ public class JsFirInvalidationTestGenerated extends AbstractJsFirInvalidationTes
|
|||||||
runTest("js/js.translator/testData/incremental/invalidation/enumsInInlineFunctions/");
|
runTest("js/js.translator/testData/incremental/invalidation/enumsInInlineFunctions/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("esModules")
|
|
||||||
public void testEsModules() throws Exception {
|
|
||||||
runTest("js/js.translator/testData/incremental/invalidation/esModules/");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("exceptionsFromInlineFunction")
|
@TestMetadata("exceptionsFromInlineFunction")
|
||||||
public void testExceptionsFromInlineFunction() throws Exception {
|
public void testExceptionsFromInlineFunction() throws Exception {
|
||||||
|
|||||||
Generated
-6
@@ -115,12 +115,6 @@ public class JsIrES6InvalidationTestGenerated extends AbstractJsIrES6Invalidatio
|
|||||||
runTest("js/js.translator/testData/incremental/invalidation/enumsInInlineFunctions/");
|
runTest("js/js.translator/testData/incremental/invalidation/enumsInInlineFunctions/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("esModules")
|
|
||||||
public void testEsModules() throws Exception {
|
|
||||||
runTest("js/js.translator/testData/incremental/invalidation/esModules/");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("exceptionsFromInlineFunction")
|
@TestMetadata("exceptionsFromInlineFunction")
|
||||||
public void testExceptionsFromInlineFunction() throws Exception {
|
public void testExceptionsFromInlineFunction() throws Exception {
|
||||||
|
|||||||
-6
@@ -115,12 +115,6 @@ public class JsIrInvalidationTestGenerated extends AbstractJsIrInvalidationTest
|
|||||||
runTest("js/js.translator/testData/incremental/invalidation/enumsInInlineFunctions/");
|
runTest("js/js.translator/testData/incremental/invalidation/enumsInInlineFunctions/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("esModules")
|
|
||||||
public void testEsModules() throws Exception {
|
|
||||||
runTest("js/js.translator/testData/incremental/invalidation/esModules/");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("exceptionsFromInlineFunction")
|
@TestMetadata("exceptionsFromInlineFunction")
|
||||||
public void testExceptionsFromInlineFunction() throws Exception {
|
public void testExceptionsFromInlineFunction() throws Exception {
|
||||||
|
|||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
data class Demo(val x: Int) {
|
|
||||||
}
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
class Demo(val x: Int) {
|
|
||||||
}
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
inline class Demo(val x: Int) {
|
|
||||||
}
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
STEP 0:
|
|
||||||
modifications:
|
|
||||||
U : l1.0_data_class.kt -> l1.kt
|
|
||||||
added file: l1.kt
|
|
||||||
STEP 1:
|
|
||||||
modifications:
|
|
||||||
U : l1.1_simple_class.kt -> l1.kt
|
|
||||||
modified ir: l1.kt
|
|
||||||
STEP 2:
|
|
||||||
modifications:
|
|
||||||
U : l1.2_inline_class.kt -> l1.kt
|
|
||||||
modified ir: l1.kt
|
|
||||||
STEP 3:
|
|
||||||
modifications:
|
|
||||||
U : l1.1_simple_class.kt -> l1.kt
|
|
||||||
modified ir: l1.kt
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
fun box(stepId: Int): String {
|
|
||||||
val d = Demo(15)
|
|
||||||
when (stepId) {
|
|
||||||
0, 2 -> {
|
|
||||||
if (!testEquals(d, Demo(15))) return "Fail equals"
|
|
||||||
if (testHashCode(d) != Demo(15).hashCode()) return "Fail hashCode"
|
|
||||||
if (testToString(d) != "Demo(x=15)") return "Fail toString"
|
|
||||||
}
|
|
||||||
1, 3-> {
|
|
||||||
if (testEquals(d, Demo(15))) return "Fail equals"
|
|
||||||
if (testHashCode(d) == Demo(15).hashCode()) return "Fail hashCode"
|
|
||||||
if (testToString(d) != "[object Object]") return "Fail toString"
|
|
||||||
}
|
|
||||||
else -> return "Unknown"
|
|
||||||
}
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
STEP 0:
|
|
||||||
dependencies: lib1
|
|
||||||
added file: m.kt, testEquals.kt, testHashCode.kt, testToString.kt
|
|
||||||
STEP 1..3:
|
|
||||||
dependencies: lib1
|
|
||||||
updated imports: m.kt, testEquals.kt, testHashCode.kt, testToString.kt
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
fun testEquals(lhs: Demo, rhs: Demo): Boolean {
|
|
||||||
return lhs == rhs
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
fun testHashCode(d: Demo): Int {
|
|
||||||
return d.hashCode()
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
fun testToString(d: Demo): String {
|
|
||||||
return d.toString()
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
MODULES: lib1, main
|
|
||||||
MODULE_KIND: es
|
|
||||||
|
|
||||||
STEP 0:
|
|
||||||
libs: lib1, main
|
|
||||||
dirty js: lib1, main
|
|
||||||
STEP 1..3:
|
|
||||||
libs: lib1, main
|
|
||||||
dirty js: lib1, main
|
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
(function (_) {
|
|
||||||
'use strict';
|
|
||||||
function externalDemoFunction() { return 3; }
|
|
||||||
|
|
||||||
_.externalDemoFunction = externalDemoFunction;
|
|
||||||
|
|
||||||
return _
|
|
||||||
}(module.exports));
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export function externalDemoFunction() { return 3; }
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
(function (_) {
|
|
||||||
'use strict';
|
|
||||||
function externalDemoFunction() { return 0; }
|
|
||||||
|
|
||||||
_.externalDemoFunction = externalDemoFunction;
|
|
||||||
|
|
||||||
return _
|
|
||||||
}(module.exports));
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export function externalDemoFunction() { return 0; }
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
(function (_) {
|
|
||||||
'use strict';
|
|
||||||
function externalDemoFunction() { return 2; }
|
|
||||||
|
|
||||||
_.externalDemoFunction = externalDemoFunction;
|
|
||||||
|
|
||||||
return _
|
|
||||||
}(module.exports));
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export function externalDemoFunction() { return 2; }
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
(function (_) {
|
|
||||||
'use strict';
|
|
||||||
function externalDemoFunction() { return 1; }
|
|
||||||
|
|
||||||
_.externalDemoFunction = externalDemoFunction;
|
|
||||||
|
|
||||||
return _
|
|
||||||
}(module.exports));
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export function externalDemoFunction() { return 1; }
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
(function (_) {
|
|
||||||
'use strict';
|
|
||||||
function externalDemoFunction() { return 5; }
|
|
||||||
|
|
||||||
_.externalDemoFunction = externalDemoFunction;
|
|
||||||
|
|
||||||
return _
|
|
||||||
}(module.exports));
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export function externalDemoFunction() { return 5; }
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
(function (_) {
|
|
||||||
'use strict';
|
|
||||||
function externalDemoFunction() { return 4; }
|
|
||||||
|
|
||||||
_.externalDemoFunction = externalDemoFunction;
|
|
||||||
|
|
||||||
return _
|
|
||||||
}(module.exports));
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export function externalDemoFunction() { return 4; }
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
@file:JsModule("js-module-a")
|
@file:JsModule("./js-module-a.mjs")
|
||||||
|
|
||||||
external fun externalDemoFunction(): Int
|
external fun externalDemoFunction(): Int
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
@file:JsModule("js-module-a")
|
@file:JsModule("./js-module-a.mjs")
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
@file:JsModule("js-module-a-new")
|
@file:JsModule("./js-module-a-new.mjs")
|
||||||
|
|
||||||
external fun externalDemoFunction(): Int
|
external fun externalDemoFunction(): Int
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
@file:JsModule("js-module-b")
|
@file:JsModule("./js-module-b.mjs")
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
@file:JsModule("js-module-b")
|
@file:JsModule("./js-module-b.mjs")
|
||||||
|
|
||||||
external fun externalDemoFunction(): Int
|
external fun externalDemoFunction(): Int
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
@file:JsModule("js-module-b-new")
|
@file:JsModule("./js-module-b-new.mjs")
|
||||||
|
|
||||||
external fun externalDemoFunction(): Int
|
external fun externalDemoFunction(): Int
|
||||||
|
|||||||
Reference in New Issue
Block a user