[TEST-GEN] Reorganize package structure in :generators:test-generator module
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.generators.tests
|
||||
|
||||
import org.jetbrains.kotlin.codegen.ir.AbstractCompileKotlinAgainstKlibTest
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.checkers.AbstractForeignJava8AnnotationsNoAnnotation
|
||||
import org.jetbrains.kotlin.checkers.AbstractForeignJava8AnnotationsTest
|
||||
import org.jetbrains.kotlin.checkers.AbstractJspecifyAnnotationsTest
|
||||
import org.jetbrains.kotlin.checkers.javac.AbstractJavacForeignJava8AnnotationsTest
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.jvm.compiler.AbstractLoadJava8Test
|
||||
import org.jetbrains.kotlin.jvm.compiler.AbstractLoadJava8WithPsiClassReadingTest
|
||||
import org.jetbrains.kotlin.jvm.compiler.javac.AbstractLoadJava8UsingJavacTest
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.spec.utils.tasks
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.spec.checkers.AbstractDiagnosticsTestSpec
|
||||
import org.jetbrains.kotlin.spec.checkers.AbstractFirDiagnosticsTestSpec
|
||||
import org.jetbrains.kotlin.spec.codegen.AbstractBlackBoxCodegenTestSpec
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.jetbrains.kotlin.fir.java.AbstractFirOldFrontendLightClassesTest
|
||||
import org.jetbrains.kotlin.fir.java.AbstractFirTypeEnhancementTest
|
||||
import org.jetbrains.kotlin.fir.java.AbstractOwnFirTypeEnhancementTest
|
||||
import org.jetbrains.kotlin.fir.lightTree.AbstractLightTree2FirConverterTestCase
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.integration.AbstractAntTaskTest
|
||||
import org.jetbrains.kotlin.ir.AbstractIrCfgTestCase
|
||||
import org.jetbrains.kotlin.ir.AbstractIrJsTextTestCase
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.generators.tests
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.jvm.runtime.AbstractJvm8RuntimeDescriptorLoaderTest
|
||||
import org.jetbrains.kotlin.jvm.runtime.AbstractJvmRuntimeDescriptorLoaderTest
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.generators
|
||||
|
||||
interface InconsistencyChecker {
|
||||
fun add(affectedFile: String)
|
||||
|
||||
val affectedFiles: List<String>
|
||||
|
||||
companion object {
|
||||
fun hasDryRunArg(args: Array<String>) = args.any { it == "dryRun" }
|
||||
|
||||
fun inconsistencyChecker(dryRun: Boolean) = if (dryRun) DefaultInconsistencyChecker else EmptyInconsistencyChecker
|
||||
}
|
||||
}
|
||||
|
||||
object DefaultInconsistencyChecker : InconsistencyChecker {
|
||||
private val files = mutableListOf<String>()
|
||||
|
||||
override fun add(affectedFile: String) {
|
||||
files.add(affectedFile)
|
||||
}
|
||||
|
||||
override val affectedFiles: List<String>
|
||||
get() = files
|
||||
}
|
||||
|
||||
object EmptyInconsistencyChecker : InconsistencyChecker {
|
||||
override fun add(affectedFile: String) {
|
||||
}
|
||||
|
||||
override val affectedFiles: List<String>
|
||||
get() = emptyList()
|
||||
}
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
* 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.generators.tests.generator.generators
|
||||
package org.jetbrains.kotlin.generators
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.MethodModel
|
||||
import org.jetbrains.kotlin.generators.model.MethodModel
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
abstract class MethodGenerator<in T : MethodModel> {
|
||||
+56
-85
@@ -1,19 +1,70 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
package org.jetbrains.kotlin.generators
|
||||
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.generators.tests.generator.InconsistencyChecker.Companion.hasDryRunArg
|
||||
import org.jetbrains.kotlin.generators.tests.generator.InconsistencyChecker.Companion.inconsistencyChecker
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generators.impl.*
|
||||
import org.jetbrains.kotlin.generators.impl.TestGeneratorImpl
|
||||
import org.jetbrains.kotlin.generators.model.*
|
||||
import org.jetbrains.kotlin.generators.InconsistencyChecker.Companion.hasDryRunArg
|
||||
import org.jetbrains.kotlin.generators.InconsistencyChecker.Companion.inconsistencyChecker
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import java.util.regex.Pattern
|
||||
|
||||
fun testGroupSuite(
|
||||
init: TestGroupSuite.() -> Unit
|
||||
): TestGroupSuite {
|
||||
return TestGroupSuite().apply(init)
|
||||
}
|
||||
|
||||
fun generateTestGroupSuite(
|
||||
args: Array<String>,
|
||||
init: TestGroupSuite.() -> Unit
|
||||
) {
|
||||
generateTestGroupSuite(hasDryRunArg(args), init)
|
||||
}
|
||||
|
||||
fun generateTestGroupSuite(
|
||||
dryRun: Boolean = false,
|
||||
init: TestGroupSuite.() -> Unit
|
||||
) {
|
||||
val suite = testGroupSuite(init)
|
||||
for (testGroup in suite.testGroups) {
|
||||
for (testClass in testGroup.testClasses) {
|
||||
val (changed, testSourceFilePath) = TestGeneratorImpl.generateAndSave(testClass, dryRun)
|
||||
if (changed) {
|
||||
inconsistencyChecker(dryRun).add(testSourceFilePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestGroupSuite {
|
||||
private val _testGroups = mutableListOf<TestGroup>()
|
||||
val testGroups: List<TestGroup>
|
||||
get() = _testGroups
|
||||
|
||||
fun testGroup(
|
||||
testsRoot: String,
|
||||
testDataRoot: String,
|
||||
testRunnerMethodName: String = RunTestMethodModel.METHOD_NAME,
|
||||
additionalRunnerArguments: List<String> = emptyList(),
|
||||
init: TestGroup.() -> Unit
|
||||
) {
|
||||
_testGroups += TestGroup(
|
||||
testsRoot,
|
||||
testDataRoot,
|
||||
testRunnerMethodName,
|
||||
additionalRunnerArguments,
|
||||
).apply(init)
|
||||
}
|
||||
}
|
||||
|
||||
class TestGroup(
|
||||
private val testsRoot: String,
|
||||
val testDataRoot: String,
|
||||
@@ -96,86 +147,6 @@ class TestGroup(
|
||||
}
|
||||
}
|
||||
|
||||
fun testGroupSuite(
|
||||
init: TestGroupSuite.() -> Unit
|
||||
): TestGroupSuite {
|
||||
return TestGroupSuite().apply(init)
|
||||
}
|
||||
|
||||
fun generateTestGroupSuite(
|
||||
args: Array<String>,
|
||||
init: TestGroupSuite.() -> Unit
|
||||
) {
|
||||
generateTestGroupSuite(hasDryRunArg(args), init)
|
||||
}
|
||||
|
||||
fun generateTestGroupSuite(
|
||||
dryRun: Boolean = false,
|
||||
init: TestGroupSuite.() -> Unit
|
||||
) {
|
||||
val suite = testGroupSuite(init)
|
||||
for (testGroup in suite.testGroups) {
|
||||
for (testClass in testGroup.testClasses) {
|
||||
val (changed, testSourceFilePath) = TestGeneratorImpl.generateAndSave(testClass, dryRun)
|
||||
if (changed) {
|
||||
inconsistencyChecker(dryRun).add(testSourceFilePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestGroupSuite {
|
||||
private val _testGroups = mutableListOf<TestGroup>()
|
||||
val testGroups: List<TestGroup>
|
||||
get() = _testGroups
|
||||
|
||||
fun testGroup(
|
||||
testsRoot: String,
|
||||
testDataRoot: String,
|
||||
testRunnerMethodName: String = RunTestMethodModel.METHOD_NAME,
|
||||
additionalRunnerArguments: List<String> = emptyList(),
|
||||
init: TestGroup.() -> Unit
|
||||
) {
|
||||
_testGroups += TestGroup(
|
||||
testsRoot,
|
||||
testDataRoot,
|
||||
testRunnerMethodName,
|
||||
additionalRunnerArguments,
|
||||
).apply(init)
|
||||
}
|
||||
}
|
||||
|
||||
interface InconsistencyChecker {
|
||||
fun add(affectedFile: String)
|
||||
|
||||
val affectedFiles: List<String>
|
||||
|
||||
companion object {
|
||||
fun hasDryRunArg(args: Array<String>) = args.any { it == "dryRun" }
|
||||
|
||||
fun inconsistencyChecker(dryRun: Boolean) = if (dryRun) DefaultInconsistencyChecker else EmptyInconsistencyChecker
|
||||
}
|
||||
}
|
||||
|
||||
object DefaultInconsistencyChecker : InconsistencyChecker {
|
||||
private val files = mutableListOf<String>()
|
||||
|
||||
override fun add(affectedFile: String) {
|
||||
files.add(affectedFile)
|
||||
}
|
||||
|
||||
override val affectedFiles: List<String>
|
||||
get() = files
|
||||
}
|
||||
|
||||
object EmptyInconsistencyChecker : InconsistencyChecker {
|
||||
override fun add(affectedFile: String) {
|
||||
}
|
||||
|
||||
override val affectedFiles: List<String>
|
||||
get() = emptyList()
|
||||
}
|
||||
|
||||
fun getDefaultSuiteTestClassName(baseTestClassName: String): String {
|
||||
require(baseTestClassName.startsWith("Abstract")) { "Doesn't start with \"Abstract\": $baseTestClassName" }
|
||||
return baseTestClassName.substringAfter("Abstract") + "Generated"
|
||||
+2
-3
@@ -3,10 +3,9 @@
|
||||
* 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.generators.tests.generator.generators
|
||||
package org.jetbrains.kotlin.generators
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.MethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.TestGroup
|
||||
import org.jetbrains.kotlin.generators.model.MethodModel
|
||||
|
||||
abstract class TestGenerator(
|
||||
methodGenerators: List<MethodGenerator<*>>
|
||||
+4
-4
@@ -3,11 +3,11 @@
|
||||
* 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.generators.tests.generator.generators.impl
|
||||
package org.jetbrains.kotlin.generators.impl
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.MethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.RunTestMethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.MethodModel
|
||||
import org.jetbrains.kotlin.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.RunTestMethodModel
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
+4
-4
@@ -3,12 +3,12 @@
|
||||
* 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.generators.tests.generator.generators.impl
|
||||
package org.jetbrains.kotlin.generators.impl
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.generators.tests.generator.MethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.SimpleTestClassModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.MethodModel
|
||||
import org.jetbrains.kotlin.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.SimpleTestClassModel
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
+5
-5
@@ -3,12 +3,12 @@
|
||||
* 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.generators.tests.generator.generators.impl
|
||||
package org.jetbrains.kotlin.generators.impl
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.MethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.RunTestMethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.SimpleTestMethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.MethodModel
|
||||
import org.jetbrains.kotlin.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.RunTestMethodModel
|
||||
import org.jetbrains.kotlin.generators.model.SimpleTestMethodModel
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
+4
-4
@@ -3,12 +3,12 @@
|
||||
* 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.generators.tests.generator.generators.impl
|
||||
package org.jetbrains.kotlin.generators.impl
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.generators.tests.generator.MethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.SingleClassTestModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.MethodModel
|
||||
import org.jetbrains.kotlin.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.model.SingleClassTestModel
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
+5
-4
@@ -3,11 +3,12 @@
|
||||
* 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.generators.tests.generator.generators.impl
|
||||
package org.jetbrains.kotlin.generators.impl
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.*
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generators.TestGenerator
|
||||
import org.jetbrains.kotlin.generators.MethodGenerator
|
||||
import org.jetbrains.kotlin.generators.TestGenerator
|
||||
import org.jetbrains.kotlin.generators.TestGroup
|
||||
import org.jetbrains.kotlin.generators.model.*
|
||||
import org.jetbrains.kotlin.generators.util.GeneratorsFileUtil
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
import org.jetbrains.kotlin.test.MuteExtraSuffix
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
+1
-3
@@ -3,10 +3,8 @@
|
||||
* 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.generators.util
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.MethodModel
|
||||
import org.jetbrains.kotlin.generators.tests.generator.SimpleTestMethodModel
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import java.io.File
|
||||
import java.util.regex.Pattern
|
||||
+3
-14
@@ -1,19 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
open class DelegatingTestClassModel(private val delegate: TestClassModel) : TestClassModel() {
|
||||
override val name: String
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.generators.tests.generator.TestGeneratorUtil.fileNameToJavaIdentifier
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.fileNameToJavaIdentifier
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import java.io.File
|
||||
+3
-4
@@ -1,15 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.generators.tests.generator.TestGeneratorUtil.escapeForJavaIdentifier
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.escapeForJavaIdentifier
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import java.io.File
|
||||
import java.util.regex.Pattern
|
||||
|
||||
+3
-14
@@ -1,19 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
+3
-16
@@ -1,22 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2020 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.generators.tests.generator
|
||||
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
interface TestEntityModel {
|
||||
val name: String
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.kotlin.generators.tests.generator
|
||||
|
||||
import kotlin.text.capitalize
|
||||
import org.jetbrains.kotlin.generators.tests.generator.TestGeneratorUtil
|
||||
import java.io.File
|
||||
import java.lang.StringBuilder
|
||||
|
||||
object TestGeneratorUtil {
|
||||
@JvmStatic
|
||||
fun escapeForJavaIdentifier(fileName: String): String {
|
||||
// A file name may contain characters (like ".") that can't be a part of method name
|
||||
val result = StringBuilder()
|
||||
for (c in fileName) {
|
||||
if (Character.isJavaIdentifierPart(c)) {
|
||||
result.append(c)
|
||||
} else {
|
||||
result.append("_")
|
||||
}
|
||||
}
|
||||
return result.toString()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun fileNameToJavaIdentifier(file: File): String {
|
||||
return escapeForJavaIdentifier(file.name).capitalize()
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.generators.util
|
||||
|
||||
import org.intellij.lang.annotations.Language
|
||||
import kotlin.text.capitalize
|
||||
import java.io.File
|
||||
import java.lang.StringBuilder
|
||||
|
||||
object TestGeneratorUtil {
|
||||
@Language("RegExp") const val KT_OR_KTS = """^(.+)\.(kt|kts)$"""
|
||||
@Language("RegExp") const val KT_OR_KTS_WITHOUT_DOTS_IN_NAME = """^([^.]+)\.(kt|kts)$"""
|
||||
|
||||
@Language("RegExp") const val KT_WITHOUT_DOTS_IN_NAME = """^([^.]+)\.kt$"""
|
||||
|
||||
@JvmStatic
|
||||
fun escapeForJavaIdentifier(fileName: String): String {
|
||||
// A file name may contain characters (like ".") that can't be a part of method name
|
||||
val result = StringBuilder()
|
||||
for (c in fileName) {
|
||||
if (Character.isJavaIdentifierPart(c)) {
|
||||
result.append(c)
|
||||
} else {
|
||||
result.append("_")
|
||||
}
|
||||
}
|
||||
return result.toString()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun fileNameToJavaIdentifier(file: File): String {
|
||||
return escapeForJavaIdentifier(file.name).capitalize()
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.generators.util
|
||||
|
||||
import org.intellij.lang.annotations.Language
|
||||
|
||||
@Language("RegExp") const val KT_OR_KTS = """^(.+)\.(kt|kts)$"""
|
||||
@Language("RegExp") const val KT_OR_KTS_WITHOUT_DOTS_IN_NAME = """^([^.]+)\.(kt|kts)$"""
|
||||
|
||||
@Language("RegExp") const val KT_WITHOUT_DOTS_IN_NAME = """^([^.]+)\.kt$"""
|
||||
@@ -24,12 +24,12 @@ import org.jetbrains.kotlin.findUsages.*
|
||||
import org.jetbrains.kotlin.fir.plugin.AbstractFirAllOpenDiagnosticTest
|
||||
import org.jetbrains.kotlin.formatter.AbstractFormatterTest
|
||||
import org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase
|
||||
import org.jetbrains.kotlin.generators.tests.generator.TestGroup
|
||||
import org.jetbrains.kotlin.generators.tests.generator.muteExtraSuffix
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.util.KT_OR_KTS
|
||||
import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.TestGroup
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.model.muteExtraSuffix
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
|
||||
import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest
|
||||
import org.jetbrains.kotlin.idea.actions.AbstractGotoTestOrCodeActionTest
|
||||
|
||||
@@ -29,12 +29,12 @@ import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest
|
||||
import org.jetbrains.kotlin.findUsages.AbstractKotlinFindUsagesWithLibraryTest
|
||||
import org.jetbrains.kotlin.formatter.AbstractFormatterTest
|
||||
import org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase
|
||||
import org.jetbrains.kotlin.generators.tests.generator.TestGroup
|
||||
import org.jetbrains.kotlin.generators.tests.generator.muteExtraSuffix
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.util.KT_OR_KTS
|
||||
import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.TestGroup
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.model.muteExtraSuffix
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
|
||||
import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest
|
||||
import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest
|
||||
|
||||
@@ -29,12 +29,12 @@ import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest
|
||||
import org.jetbrains.kotlin.findUsages.AbstractKotlinFindUsagesWithLibraryTest
|
||||
import org.jetbrains.kotlin.formatter.AbstractFormatterTest
|
||||
import org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase
|
||||
import org.jetbrains.kotlin.generators.tests.generator.TestGroup
|
||||
import org.jetbrains.kotlin.generators.tests.generator.muteExtraSuffix
|
||||
import org.jetbrains.kotlin.generators.tests.generator.testGroup
|
||||
import org.jetbrains.kotlin.generators.util.KT_OR_KTS
|
||||
import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.TestGroup
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.model.muteExtraSuffix
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME
|
||||
import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
|
||||
import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest
|
||||
import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.generators.tests
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.js.test.AbstractDceTest
|
||||
import org.jetbrains.kotlin.js.test.AbstractJsLineNumberTest
|
||||
import org.jetbrains.kotlin.js.test.es6.semantics.*
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.kotlinp.test
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.generator.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuite
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.pill.generateAllTests;
|
||||
|
||||
import org.jetbrains.kotlin.generators.tests.*;
|
||||
import org.jetbrains.kotlin.generators.tests.generator.InconsistencyChecker;
|
||||
import org.jetbrains.kotlin.generators.InconsistencyChecker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user