[JS] Remove legacy and output prefix-postfix tests

This commit is contained in:
Ilya Goncharov
2023-06-13 12:17:52 +02:00
committed by Space Team
parent 1465abcfed
commit 1c89a7e400
14 changed files with 5 additions and 10121 deletions
@@ -90,18 +90,11 @@ fun main(args: Array<String>) {
}
testGroup("js/js.tests/tests-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") {
testClass<AbstractBoxJsTest> {
model("box/", pattern = "^([^_](.+))\\.kt$", excludeDirs = listOf("closure/inlineAnonymousFunctions", "es6classes"))
}
testClass<AbstractSourceMapGenerationSmokeTest> {
model("sourcemap/")
}
testClass<AbstractOutputPrefixPostfixTest> {
model("outputPrefixPostfix/")
}
testClass<AbstractMultiModuleOrderTest> {
model("multiModuleOrder/")
}
@@ -62,36 +62,6 @@ abstract class AbstractJsTest(
}
}
open class AbstractBoxJsTest : AbstractJsTest(pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/box/", testGroupOutputDirPrefix = "box/") {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+JsEnvironmentConfigurationDirectives.RUN_MINIFIER_BY_DEFAULT
}
}
}
}
open class AbstractOutputPrefixPostfixTest : AbstractJsTest(
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/outputPrefixPostfix/",
testGroupOutputDirPrefix = "outputPrefixPostfix/"
) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
-JsEnvironmentConfigurationDirectives.GENERATE_NODE_JS_RUNNER
}
configureJsArtifactsHandlersStep {
useHandlers(
::JsPrefixPostfixHandler
)
}
}
}
}
open class AbstractMultiModuleOrderTest : AbstractJsTest(
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/multiModuleOrder/",
testGroupOutputDirPrefix = "multiModuleOrder/"
@@ -1,26 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.handlers
import org.jetbrains.kotlin.test.backend.handlers.JsBinaryArtifactHandler
import org.jetbrains.kotlin.test.model.BinaryArtifacts
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator
class JsPrefixPostfixHandler(testServices: TestServices) : JsBinaryArtifactHandler(testServices) {
override fun processModule(module: TestModule, info: BinaryArtifacts.Js) {
val outputPrefixFile = JsEnvironmentConfigurator.getPrefixFile(module)
val outputPostfixFile = JsEnvironmentConfigurator.getPostfixFile(module)
val outputText = info.outputFile.readText()
outputPrefixFile?.let { testServices.assertions.assertTrue(outputText.startsWith(it.readText())) }
outputPostfixFile?.let { testServices.assertions.assertTrue(outputText.endsWith(it.readText())) }
}
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {}
}
@@ -9,15 +9,14 @@ import org.jetbrains.kotlin.js.test.JsSteppingTestAdditionalSourceProvider
import org.jetbrains.kotlin.js.test.converters.JsIrBackendFacade
import org.jetbrains.kotlin.js.test.converters.JsKlibBackendFacade
import org.jetbrains.kotlin.js.test.converters.incremental.RecompileModuleJsIrBackendFacade
import org.jetbrains.kotlin.js.test.handlers.JsDebugRunner
import org.jetbrains.kotlin.js.test.handlers.JsDtsHandler
import org.jetbrains.kotlin.js.test.handlers.JsIrRecompiledArtifactsIdentityHandler
import org.jetbrains.kotlin.js.test.handlers.JsLineNumberHandler
import org.jetbrains.kotlin.js.test.handlers.*
import org.jetbrains.kotlin.parsing.parseBoolean
import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
import org.jetbrains.kotlin.test.builders.*
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.builders.configureJsArtifactsHandlersStep
import org.jetbrains.kotlin.test.builders.jsArtifactsHandlersStep
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
@@ -29,7 +28,7 @@ import java.lang.Boolean.getBoolean
abstract class AbstractJsIrTest(
pathToTestDir: String,
testGroupOutputDirPrefix: String,
targetBackend: TargetBackend = TargetBackend.JS_IR
targetBackend: TargetBackend = TargetBackend.JS_IR,
) : AbstractJsBlackBoxCodegenTestBase<ClassicFrontendOutputArtifact, IrBackendInput, BinaryArtifacts.KLib>(
FrontendKinds.ClassicFrontend, targetBackend, pathToTestDir, testGroupOutputDirPrefix, skipMinification = true
) {
File diff suppressed because it is too large Load Diff
@@ -1,51 +0,0 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("js/js.translator/testData/outputPrefixPostfix")
@TestDataPath("$PROJECT_ROOT")
public class OutputPrefixPostfixTestGenerated extends AbstractOutputPrefixPostfixTest {
@Test
public void testAllFilesPresentInOutputPrefixPostfix() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/outputPrefixPostfix"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("js/js.translator/testData/outputPrefixPostfix/simple.kt");
}
@Test
@TestMetadata("simpleWithPostfix.kt")
public void testSimpleWithPostfix() throws Exception {
runTest("js/js.translator/testData/outputPrefixPostfix/simpleWithPostfix.kt");
}
@Test
@TestMetadata("simpleWithPrefix.kt")
public void testSimpleWithPrefix() throws Exception {
runTest("js/js.translator/testData/outputPrefixPostfix/simpleWithPrefix.kt");
}
@Test
@TestMetadata("simpleWithPrefixAndPostfix.kt")
public void testSimpleWithPrefixAndPostfix() throws Exception {
runTest("js/js.translator/testData/outputPrefixPostfix/simpleWithPrefixAndPostfix.kt");
}
}
@@ -1,5 +0,0 @@
package foo
fun box(): String {
return "OK"
}
@@ -1,5 +0,0 @@
package foo
fun box(): String {
return "OK"
}
@@ -1,3 +0,0 @@
/*
SOME POSTFIX
*/
@@ -1,5 +0,0 @@
package foo
fun box(): String {
return "OK"
}
@@ -1,3 +0,0 @@
/*
SOME PREFIX
*/
@@ -1,5 +0,0 @@
package foo
fun box(): String {
return "OK"
}
@@ -1,3 +0,0 @@
/*
SOME POSTFIX
*/
@@ -1,3 +0,0 @@
/*
SOME PREFIX
*/