[JS] Migrate multi module order test
This commit is contained in:
committed by
Space Team
parent
08c04af5b5
commit
b5a7b9c661
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.js.test.ir.*
|
||||
import org.jetbrains.kotlin.js.testOld.AbstractDceTest
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.js.test.fir.AbstractFirLightTreeJsIrTextTest
|
||||
import org.jetbrains.kotlin.js.test.ir.AbstractMultiModuleOrderTest
|
||||
import org.jetbrains.kotlin.js.testOld.klib.AbstractClassicJsKlibEvolutionTest
|
||||
import org.jetbrains.kotlin.js.testOld.klib.AbstractFirJsKlibEvolutionTest
|
||||
|
||||
|
||||
@@ -62,22 +62,6 @@ abstract class AbstractJsTest(
|
||||
}
|
||||
}
|
||||
|
||||
open class AbstractMultiModuleOrderTest : AbstractJsTest(
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/multiModuleOrder/",
|
||||
testGroupOutputDirPrefix = "multiModuleOrder/"
|
||||
) {
|
||||
override fun configure(builder: TestConfigurationBuilder) {
|
||||
super.configure(builder)
|
||||
with(builder) {
|
||||
configureJsArtifactsHandlersStep {
|
||||
useHandlers(
|
||||
::JsWrongModuleHandler
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class AbstractWebDemoExamplesTest : AbstractJsTest(
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/webDemoExamples/",
|
||||
testGroupOutputDirPrefix = "webDemoExamples/"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.test.handlers
|
||||
|
||||
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.TranslationMode
|
||||
import org.jetbrains.kotlin.js.test.utils.getTestChecker
|
||||
import org.jetbrains.kotlin.test.backend.handlers.JsBinaryArtifactHandler
|
||||
import org.jetbrains.kotlin.test.model.BinaryArtifacts
|
||||
@@ -20,16 +21,17 @@ class JsWrongModuleHandler(testServices: TestServices) : JsBinaryArtifactHandler
|
||||
|
||||
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
|
||||
val originalFileName = testServices.moduleStructure.originalTestDataFiles.first().nameWithoutExtension
|
||||
val parentDir = JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices)
|
||||
val parentDir = JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, translationMode = TranslationMode.PER_MODULE_DEV)
|
||||
val kotlinJsFile = File(parentDir, "$originalFileName-kotlin_kotlin_v5.js").path
|
||||
val mainJsFile = File(parentDir, "${originalFileName}_v5.js").path
|
||||
val libJsFile = File(parentDir, "$originalFileName-lib_v5.js").path
|
||||
val libJsFile = File(parentDir, "$originalFileName-kotlin_lib_v5.js").path
|
||||
try {
|
||||
getTestChecker(testServices).run(listOf(mainJsFile, libJsFile))
|
||||
getTestChecker(testServices).run(listOf(kotlinJsFile, mainJsFile, libJsFile))
|
||||
} catch (e: RuntimeException) {
|
||||
testServices.assertions.assertTrue(e is IllegalStateException)
|
||||
val message = e.message!!
|
||||
|
||||
testServices.assertions.assertTrue("'lib'" in message) {
|
||||
testServices.assertions.assertTrue("'kotlin_lib'" in message) {
|
||||
"Exception message should contain reference to dependency (lib)"
|
||||
}
|
||||
testServices.assertions.assertTrue("'main'" in message) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.test.ir
|
||||
|
||||
import org.jetbrains.kotlin.js.test.AbstractJsTest
|
||||
import org.jetbrains.kotlin.js.test.JsSteppingTestAdditionalSourceProvider
|
||||
import org.jetbrains.kotlin.js.test.converters.JsIrBackendFacade
|
||||
import org.jetbrains.kotlin.js.test.converters.JsKlibBackendFacade
|
||||
@@ -146,6 +147,22 @@ open class AbstractSourceMapGenerationSmokeTest : AbstractJsIrTest(
|
||||
}
|
||||
}
|
||||
|
||||
open class AbstractMultiModuleOrderTest : AbstractJsIrTest(
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/multiModuleOrder/",
|
||||
testGroupOutputDirPrefix = "multiModuleOrder/"
|
||||
) {
|
||||
override fun configure(builder: TestConfigurationBuilder) {
|
||||
super.configure(builder)
|
||||
with(builder) {
|
||||
configureJsArtifactsHandlersStep {
|
||||
useHandlers(
|
||||
::JsWrongModuleHandler
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun configureJsIrLineNumberTest(builder: TestConfigurationBuilder) {
|
||||
with(builder) {
|
||||
defaultDirectives {
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test;
|
||||
package org.jetbrains.kotlin.js.test.ir;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
|
||||
public class MultiModuleOrderTestGenerated extends AbstractMultiModuleOrderTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInMultiModuleOrder() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/multiModuleOrder"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/multiModuleOrder"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPLIT_PER_MODULE
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
package lib
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPLIT_PER_MODULE
|
||||
// MODULE: lib
|
||||
// MODULE_KIND: UMD
|
||||
// FILE: lib.kt
|
||||
|
||||
Reference in New Issue
Block a user