Refactor files in the 'spec' package

This commit is contained in:
victor.petukhov
2018-09-25 12:56:36 +03:00
parent 45c5a168a3
commit 4bfa90dc25
4 changed files with 14 additions and 13 deletions
@@ -3,15 +3,19 @@
* that can be found in the license/LICENSE.txt file. * that can be found in the license/LICENSE.txt file.
*/ */
package org.jetbrains.kotlin.generators.tests package org.jetbrains.kotlin.spec.tasks
import org.jetbrains.kotlin.generators.tests.generator.testGroup import org.jetbrains.kotlin.generators.tests.generator.testGroup
import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTestSpec import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTestSpec
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TEST_PATH
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
fun main(args: Array<String>) { fun generateTests() {
testGroup("compiler/tests-spec/tests", "compiler/tests-spec/testData") { testGroup(TEST_PATH, TESTDATA_PATH) {
testClass<AbstractDiagnosticsTestSpec> { testClass<AbstractDiagnosticsTestSpec> {
model("diagnostics", excludeDirs = listOf("helpers")) model("diagnostics", excludeDirs = listOf("helpers"))
} }
} }
} }
fun main(args: Array<String>) = generateTests()
@@ -5,9 +5,9 @@
package org.jetbrains.kotlin.spec.tasks package org.jetbrains.kotlin.spec.tasks
import org.jetbrains.kotlin.spec.SpecTestsStatElement import org.jetbrains.kotlin.spec.utils.SpecTestsStatElement
import org.jetbrains.kotlin.spec.SpecTestsStatElementType import org.jetbrains.kotlin.spec.utils.SpecTestsStatElementType
import org.jetbrains.kotlin.spec.TestsStatisticCollector import org.jetbrains.kotlin.spec.utils.TestsStatisticCollector
import org.jetbrains.kotlin.spec.validators.SpecTestLinkedType import org.jetbrains.kotlin.spec.validators.SpecTestLinkedType
const val PRINT_BASE_INDENT = " " const val PRINT_BASE_INDENT = " "
@@ -3,12 +3,11 @@
* that can be found in the license/LICENSE.txt file. * that can be found in the license/LICENSE.txt file.
*/ */
package org.jetbrains.kotlin.spec package org.jetbrains.kotlin.spec.utils
import com.google.gson.* import com.google.gson.*
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import org.jetbrains.kotlin.spec.validators.* import org.jetbrains.kotlin.spec.validators.*
import java.io.File
object TestsJsonMapBuilder { object TestsJsonMapBuilder {
private val stringListType = object : TypeToken<List<String>>() {}.type private val stringListType = object : TypeToken<List<String>>() {}.type
@@ -3,8 +3,9 @@
* that can be found in the license/LICENSE.txt file. * that can be found in the license/LICENSE.txt file.
*/ */
package org.jetbrains.kotlin.spec package org.jetbrains.kotlin.spec.utils
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
import org.jetbrains.kotlin.spec.validators.* import org.jetbrains.kotlin.spec.validators.*
import java.io.File import java.io.File
@@ -25,8 +26,6 @@ enum class SpecTestsStatElementType {
} }
object TestsStatisticCollector { object TestsStatisticCollector {
private const val TEST_DATA_DIR = "./testData"
private fun incrementStatCounters(baseStatElement: SpecTestsStatElement, elementTypes: List<Pair<SpecTestsStatElementType, Any>>) { private fun incrementStatCounters(baseStatElement: SpecTestsStatElement, elementTypes: List<Pair<SpecTestsStatElementType, Any>>) {
var currentStatElement = baseStatElement var currentStatElement = baseStatElement
@@ -43,8 +42,7 @@ object TestsStatisticCollector {
val statistic = mutableMapOf<TestArea, SpecTestsStatElement>() val statistic = mutableMapOf<TestArea, SpecTestsStatElement>()
for (specTestArea in TestArea.values()) { for (specTestArea in TestArea.values()) {
val specTestsPath = val specTestsPath = "$TESTDATA_PATH/${specTestArea.name.toLowerCase()}/${testLinkedType.testDataPath}"
"$TEST_DATA_DIR/${specTestArea.name.toLowerCase()}/${AbstractSpecTestValidator.dirsByLinkedType[testLinkedType]}"
statistic[specTestArea] = SpecTestsStatElement(SpecTestsStatElementType.AREA) statistic[specTestArea] = SpecTestsStatElement(SpecTestsStatElementType.AREA)