Group spec tests and accompanying functionality into to packages: org.jetbrains.kotlin.spec (tests only) and org.jetbrains.kotlin.spec.utils (accompanying functionality)
This commit is contained in:
@@ -20,16 +20,16 @@ projectTest(parallel = true) {
|
|||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
}
|
}
|
||||||
|
|
||||||
val generateSpecTests by generator("org.jetbrains.kotlin.spec.tasks.GenerateSpecTestsKt")
|
val generateSpecTests by generator("org.jetbrains.kotlin.spec.utils.tasks.GenerateSpecTestsKt")
|
||||||
|
|
||||||
val generateFeatureInteractionSpecTestData by generator("org.jetbrains.kotlin.spec.tasks.GenerateFeatureInteractionSpecTestDataKt")
|
val generateFeatureInteractionSpecTestData by generator("org.jetbrains.kotlin.spec.utils.tasks.GenerateFeatureInteractionSpecTestDataKt")
|
||||||
|
|
||||||
val printSpecTestsStatistic by generator("org.jetbrains.kotlin.spec.tasks.PrintSpecTestsStatisticKt")
|
val printSpecTestsStatistic by generator("org.jetbrains.kotlin.spec.utils.tasks.PrintSpecTestsStatisticKt")
|
||||||
|
|
||||||
val generateJsonTestsMap by generator("org.jetbrains.kotlin.spec.tasks.GenerateJsonTestsMapKt")
|
val generateJsonTestsMap by generator("org.jetbrains.kotlin.spec.utils.tasks.GenerateJsonTestsMapKt")
|
||||||
|
|
||||||
val remoteRunTests by task<Test> {
|
val remoteRunTests by task<Test> {
|
||||||
val packagePrefix = "org.jetbrains.kotlin."
|
val packagePrefix = "org.jetbrains.kotlin.spec."
|
||||||
val includeTests = setOf(
|
val includeTests = setOf(
|
||||||
"checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Contracts*",
|
"checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Contracts*",
|
||||||
"checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Annotations*",
|
"checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Annotations*",
|
||||||
|
|||||||
-1496
File diff suppressed because it is too large
Load Diff
+9
-9
@@ -1,27 +1,27 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.checkers
|
package org.jetbrains.kotlin.spec.checkers
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import org.jetbrains.kotlin.TestExceptionsComparator
|
import org.jetbrains.kotlin.TestExceptionsComparator
|
||||||
import org.jetbrains.kotlin.TestsExceptionType
|
|
||||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.spec.models.AbstractSpecTest
|
import org.jetbrains.kotlin.spec.utils.SpecTestLinkedType
|
||||||
import org.jetbrains.kotlin.spec.SpecTestLinkedType
|
import org.jetbrains.kotlin.spec.utils.models.AbstractSpecTest
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser
|
||||||
import org.jetbrains.kotlin.spec.validators.*
|
import org.jetbrains.kotlin.spec.utils.validators.DiagnosticTestTypeValidator
|
||||||
|
import org.jetbrains.kotlin.spec.utils.validators.SpecTestValidationException
|
||||||
import org.jetbrains.kotlin.test.*
|
import org.jetbrains.kotlin.test.*
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
|
|
||||||
abstract class AbstractDiagnosticsTestSpec : AbstractDiagnosticsTest() {
|
abstract class AbstractDiagnosticsTestSpec : org.jetbrains.kotlin.checkers.AbstractDiagnosticsTest() {
|
||||||
companion object {
|
companion object {
|
||||||
private val withoutDescriptorsTestGroups = listOf(
|
private val withoutDescriptorsTestGroups = listOf(
|
||||||
"linked/when-expression"
|
"linked/when-expression"
|
||||||
+391
-468
File diff suppressed because it is too large
Load Diff
+479
-427
File diff suppressed because it is too large
Load Diff
+7
-5
@@ -1,14 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.parsing
|
package org.jetbrains.kotlin.spec.parsing
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import org.jetbrains.kotlin.TestExceptionsComparator
|
import org.jetbrains.kotlin.TestExceptionsComparator
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser
|
import org.jetbrains.kotlin.parsing.AbstractParsingTest
|
||||||
import org.jetbrains.kotlin.spec.validators.*
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser
|
||||||
|
import org.jetbrains.kotlin.spec.utils.validators.ParsingTestTypeValidator
|
||||||
|
import org.jetbrains.kotlin.spec.utils.validators.SpecTestValidationException
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
+1187
File diff suppressed because it is too large
Load Diff
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 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.spec.tasks
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import org.jetbrains.kotlin.spec.models.LinkedSpecTest
|
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser
|
|
||||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.MODULE_PATH
|
|
||||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
|
||||||
import org.jetbrains.kotlin.spec.utils.TestsJsonMapBuilder
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
private const val OUT_DIR = "out"
|
|
||||||
private const val OUT_FILENAME = "testsMap.json"
|
|
||||||
|
|
||||||
fun main() {
|
|
||||||
val testsMap = JsonObject()
|
|
||||||
|
|
||||||
File(TESTDATA_PATH).walkTopDown().forEach {
|
|
||||||
val (specTest, _) = CommonParser.parseSpecTest(it.canonicalPath, mapOf("main.kt" to it.readText()))
|
|
||||||
|
|
||||||
if (specTest is LinkedSpecTest)
|
|
||||||
TestsJsonMapBuilder.buildJsonElement(specTest, testsMap)
|
|
||||||
}
|
|
||||||
|
|
||||||
val outDir = "$MODULE_PATH/$OUT_DIR"
|
|
||||||
|
|
||||||
File(outDir).mkdir()
|
|
||||||
File("$outDir/$OUT_FILENAME").writeText(testsMap.toString())
|
|
||||||
}
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 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.spec.tasks
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTestSpec
|
|
||||||
import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTestSpec
|
|
||||||
import org.jetbrains.kotlin.generators.tests.generator.testGroup
|
|
||||||
import org.jetbrains.kotlin.parsing.AbstractParsingTestSpec
|
|
||||||
import org.jetbrains.kotlin.spec.models.LinkedSpecTest
|
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser
|
|
||||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
|
||||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TEST_PATH
|
|
||||||
import java.io.File
|
|
||||||
import java.lang.StringBuilder
|
|
||||||
|
|
||||||
private data class TestReferences(var testsRelevant: MutableSet<String>? = null, var testNumber: Int = 0)
|
|
||||||
|
|
||||||
private typealias TestsBySections = MutableMap<String, TestsByParagraph>
|
|
||||||
private typealias TestsByParagraph = MutableMap<Int, TestsByType>
|
|
||||||
private typealias TestsByType = MutableMap<String, TestsBySentence>
|
|
||||||
private typealias TestsBySentence = MutableMap<Int, TestReferences>
|
|
||||||
|
|
||||||
private object TestsMapGenerator {
|
|
||||||
private const val TESTS_MAP_FILE_HEADER = """/*
|
|
||||||
* This file is generated by {@link org.jetbrains.kotlin.spec.tasks.generateTests}. DO NOT MODIFY MANUALLY.
|
|
||||||
* This file is used in the HTML version of the Kotlin Specification (https://kotlin.github.io/kotlin-spec) to show tests coverage for sentences.
|
|
||||||
*
|
|
||||||
* Content format:
|
|
||||||
*
|
|
||||||
* {paragraphNumber}
|
|
||||||
* {testType: neg|pos}: {sentenceNumber}-{numberOfTests|testPathToAnotherSection}, ...
|
|
||||||
*/
|
|
||||||
"""
|
|
||||||
private const val LINKED_TESTS_PATH = "$TESTDATA_PATH/diagnostics/linked"
|
|
||||||
private const val TESTS_MAP_FILENAME = "testsMap.txt"
|
|
||||||
private val lineBreak = System.lineSeparator()
|
|
||||||
|
|
||||||
private fun createObjectsPath(specTest: LinkedSpecTest, testsMap: TestsBySections): TestReferences {
|
|
||||||
val sections = specTest.place.sections.joinToString("/")
|
|
||||||
val testsBySection = testsMap.getOrPut(sections) { mutableMapOf() }
|
|
||||||
val testsByParagraph = testsBySection.getOrPut(specTest.place.paragraphNumber) { mutableMapOf() }
|
|
||||||
val testsByType = testsByParagraph.getOrPut(specTest.testType.type) { mutableMapOf() }
|
|
||||||
|
|
||||||
return testsByType.getOrPut(specTest.place.sentenceNumber) { TestReferences() }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun appendRelevantTests(specTest: LinkedSpecTest, testsMap: TestsBySections) {
|
|
||||||
if (specTest.relevantPlaces == null) return
|
|
||||||
|
|
||||||
specTest.relevantPlaces.forEach {
|
|
||||||
val sections = it.sections.joinToString("/")
|
|
||||||
val testsBySection = testsMap.getOrPut(sections) { mutableMapOf() }
|
|
||||||
val testsByParagraph = testsBySection.getOrPut(it.paragraphNumber) { mutableMapOf() }
|
|
||||||
val testsByType = testsByParagraph.getOrPut(specTest.testType.type) { mutableMapOf() }
|
|
||||||
val testReferences = testsByType.getOrPut(it.sentenceNumber) { TestReferences() }
|
|
||||||
|
|
||||||
if (testReferences.testsRelevant == null) {
|
|
||||||
testReferences.testsRelevant = mutableSetOf()
|
|
||||||
}
|
|
||||||
testReferences.testsRelevant!!.add(
|
|
||||||
"${specTest.sections.joinToString("/")}/${specTest.place.paragraphNumber}/${specTest.testType.type}/${specTest.place.sentenceNumber}.${specTest.testNumber}.kt"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun buildTestsMapAsText(testsMap: TestsByParagraph): String {
|
|
||||||
val testsMapAsText = StringBuilder()
|
|
||||||
|
|
||||||
testsMap.forEach { (paragraphNumber, testsByType) ->
|
|
||||||
testsMapAsText.append("$paragraphNumber$lineBreak")
|
|
||||||
|
|
||||||
testsByType.forEach { (testType, testsBySentence) ->
|
|
||||||
val sentenceTests = mutableListOf<String>()
|
|
||||||
|
|
||||||
testsMapAsText.append(" $testType: ")
|
|
||||||
testsBySentence.forEach { (sentenceNumber, tests) ->
|
|
||||||
if (tests.testNumber != 0) {
|
|
||||||
sentenceTests.add("$sentenceNumber-${tests.testNumber}")
|
|
||||||
}
|
|
||||||
if (tests.testsRelevant != null) {
|
|
||||||
tests.testsRelevant!!.forEach {
|
|
||||||
sentenceTests.add("$sentenceNumber-$it")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
testsMapAsText.append(sentenceTests.joinToString(", ") + lineBreak)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return testsMapAsText.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun buildTestsMapPerSection() {
|
|
||||||
val testsMap: TestsBySections = mutableMapOf()
|
|
||||||
|
|
||||||
File(LINKED_TESTS_PATH).walkTopDown().forEach {
|
|
||||||
if (!it.isFile || it.extension != "kt") return@forEach
|
|
||||||
|
|
||||||
val (specTest, _) = CommonParser.parseSpecTest(it.canonicalPath, mapOf("main.kt" to it.readText()))
|
|
||||||
|
|
||||||
if (specTest is LinkedSpecTest) {
|
|
||||||
val testReferences = createObjectsPath(specTest, testsMap)
|
|
||||||
testReferences.testNumber++
|
|
||||||
appendRelevantTests(specTest, testsMap)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
testsMap.forEach { (sections, testsByParagraph) ->
|
|
||||||
val testsMapFile = File("$LINKED_TESTS_PATH/$sections/$TESTS_MAP_FILENAME")
|
|
||||||
val testsMapAsText = buildTestsMapAsText(testsByParagraph)
|
|
||||||
|
|
||||||
testsMapFile.writeText(TESTS_MAP_FILE_HEADER + lineBreak + testsMapAsText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun generateTests() {
|
|
||||||
testGroup(TEST_PATH, TESTDATA_PATH) {
|
|
||||||
testClass<AbstractDiagnosticsTestSpec> {
|
|
||||||
model("diagnostics", excludeDirs = listOf("helpers"))
|
|
||||||
}
|
|
||||||
testClass<AbstractParsingTestSpec> {
|
|
||||||
model("psi", testMethod = "doParsingTest", excludeDirs = listOf("helpers", "templates"))
|
|
||||||
}
|
|
||||||
testClass<AbstractBlackBoxCodegenTestSpec> {
|
|
||||||
model("codegen/box", excludeDirs = listOf("helpers", "templates"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun main() {
|
|
||||||
TestsMapGenerator.buildTestsMapPerSection()
|
|
||||||
generateTests()
|
|
||||||
}
|
|
||||||
+9
-9
@@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.TestsExceptionType
|
import org.jetbrains.kotlin.TestsExceptionType
|
||||||
import org.jetbrains.kotlin.spec.models.LinkedSpecTestFileInfoElementType
|
import org.jetbrains.kotlin.spec.utils.models.LinkedSpecTestFileInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.models.NotLinkedSpecTestFileInfoElementType
|
import org.jetbrains.kotlin.spec.utils.models.NotLinkedSpecTestFileInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.parsers.BasePatterns
|
import org.jetbrains.kotlin.spec.utils.parsers.BasePatterns
|
||||||
import org.jetbrains.kotlin.spec.parsers.LinkedSpecTestPatterns
|
import org.jetbrains.kotlin.spec.utils.parsers.LinkedSpecTestPatterns
|
||||||
import org.jetbrains.kotlin.spec.parsers.NotLinkedSpecTestPatterns
|
import org.jetbrains.kotlin.spec.utils.parsers.NotLinkedSpecTestPatterns
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.withSpaces
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.withSpaces
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.utils
|
package org.jetbrains.kotlin.spec.utils
|
||||||
|
|||||||
+6
-7
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.utils
|
package org.jetbrains.kotlin.spec.utils
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.SpecTestLinkedType
|
|
||||||
import org.jetbrains.kotlin.spec.TestArea
|
|
||||||
import org.jetbrains.kotlin.spec.models.AbstractSpecTest
|
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser
|
|
||||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
||||||
|
import org.jetbrains.kotlin.spec.utils.models.AbstractSpecTest
|
||||||
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
open class SpecTestsStatElement(val type: SpecTestsStatElementType) {
|
open class SpecTestsStatElement(val type: SpecTestsStatElementType) {
|
||||||
@@ -47,7 +45,8 @@ object TestsStatisticCollector {
|
|||||||
for (specTestArea in TestArea.values()) {
|
for (specTestArea in TestArea.values()) {
|
||||||
val specTestsPath = "$TESTDATA_PATH/${specTestArea.name.toLowerCase().replace("_", "/")}/${testLinkedType.testDataPath}"
|
val specTestsPath = "$TESTDATA_PATH/${specTestArea.name.toLowerCase().replace("_", "/")}/${testLinkedType.testDataPath}"
|
||||||
|
|
||||||
statistic[specTestArea] = SpecTestsStatElement(SpecTestsStatElementType.AREA)
|
statistic[specTestArea] =
|
||||||
|
SpecTestsStatElement(SpecTestsStatElementType.AREA)
|
||||||
|
|
||||||
File(specTestsPath).walkTopDown().forEach areaTests@{
|
File(specTestsPath).walkTopDown().forEach areaTests@{
|
||||||
if (!it.isFile || it.extension != "kt") return@areaTests
|
if (!it.isFile || it.extension != "kt") return@areaTests
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.generators.templates
|
package org.jetbrains.kotlin.spec.utils.generators.templates
|
||||||
|
|
||||||
enum class Feature(val config: FeatureTemplatesConfig) {
|
enum class Feature(val config: FeatureTemplatesConfig) {
|
||||||
IDENTIFIERS(
|
IDENTIFIERS(
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.generators.templates
|
package org.jetbrains.kotlin.spec.utils.generators.templates
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+7
-5
@@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.generators.templates
|
package org.jetbrains.kotlin.spec.utils.generators.templates
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.TestArea
|
|
||||||
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
||||||
|
import org.jetbrains.kotlin.spec.utils.TestArea
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
enum class FeatureTemplatesType {
|
enum class FeatureTemplatesType {
|
||||||
@@ -43,7 +43,9 @@ class FeatureTemplatesConfig(
|
|||||||
|
|
||||||
private fun getTemplatesIterator() = lazy { getTemplates(testArea).value.iterator() }
|
private fun getTemplatesIterator() = lazy { getTemplates(testArea).value.iterator() }
|
||||||
|
|
||||||
fun resetTemplatesIterator() { currentTemplatesIterator = getTemplatesIterator() }
|
fun resetTemplatesIterator() {
|
||||||
|
currentTemplatesIterator = getTemplatesIterator()
|
||||||
|
}
|
||||||
|
|
||||||
fun getNextWithRepeat() = let {
|
fun getNextWithRepeat() = let {
|
||||||
takeUnless { it.currentTemplatesIterator.value.hasNext() }?.resetTemplatesIterator()
|
takeUnless { it.currentTemplatesIterator.value.hasNext() }?.resetTemplatesIterator()
|
||||||
+12
-12
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.generators.templates
|
package org.jetbrains.kotlin.spec.utils.generators.templates
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.SpecTestLinkedType
|
import org.jetbrains.kotlin.spec.utils.SpecTestLinkedType
|
||||||
import org.jetbrains.kotlin.spec.TestArea
|
import org.jetbrains.kotlin.spec.utils.TestArea
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
|
|
||||||
enum class SubstitutionTag(val passType: SubstitutionPassType = SubstitutionPassType.FIRST) {
|
enum class SubstitutionTag(val passType: SubstitutionPassType = SubstitutionPassType.FIRST) {
|
||||||
DIRECTIVES,
|
DIRECTIVES,
|
||||||
@@ -40,7 +40,7 @@ abstract class GenerationSpecTestDataConfig {
|
|||||||
lateinit var testArea: TestArea
|
lateinit var testArea: TestArea
|
||||||
|
|
||||||
protected val baseSubstitutions = mapOf<SubstitutionTag, (SubstitutionRule) -> String>(
|
protected val baseSubstitutions = mapOf<SubstitutionTag, (SubstitutionRule) -> String>(
|
||||||
SubstitutionTag.TEST_TYPE to { _ -> testType.toString() },
|
SubstitutionTag.TEST_TYPE to { testType.toString() },
|
||||||
SubstitutionTag.TEST_NUMBER to { rule -> rule.testNumber.toString() },
|
SubstitutionTag.TEST_NUMBER to { rule -> rule.testNumber.toString() },
|
||||||
SubstitutionTag.TEST_DESCRIPTION to { rule -> testDescription.format(rule.filename) },
|
SubstitutionTag.TEST_DESCRIPTION to { rule -> testDescription.format(rule.filename) },
|
||||||
SubstitutionTag.ELEMENT to { rule ->
|
SubstitutionTag.ELEMENT to { rule ->
|
||||||
@@ -104,10 +104,10 @@ class GenerationLinkedSpecTestDataConfig : GenerationSpecTestDataConfig() {
|
|||||||
|
|
||||||
override val layoutFilename = "linkedTestsLayout.kt"
|
override val layoutFilename = "linkedTestsLayout.kt"
|
||||||
override val substitutions = mutableMapOf<SubstitutionTag, (SubstitutionRule) -> String>(
|
override val substitutions = mutableMapOf<SubstitutionTag, (SubstitutionRule) -> String>(
|
||||||
SubstitutionTag.SECTIONS to { _ -> sections.joinToString(", ") },
|
SubstitutionTag.SECTIONS to { sections.joinToString(", ") },
|
||||||
SubstitutionTag.PARAGRAPH_NUMBER to { _ -> paragraphNumber.toString() },
|
SubstitutionTag.PARAGRAPH_NUMBER to { paragraphNumber.toString() },
|
||||||
SubstitutionTag.SENTENCE_NUMBER to { _ -> sentenceNumber.toString() },
|
SubstitutionTag.SENTENCE_NUMBER to { sentenceNumber.toString() },
|
||||||
SubstitutionTag.SENTENCE to { _ -> sentence },
|
SubstitutionTag.SENTENCE to { sentence },
|
||||||
SubstitutionTag.CLASS_OF_FILE to { rule -> "_${sentenceNumber}_${rule.testNumber}Kt" }
|
SubstitutionTag.CLASS_OF_FILE to { rule -> "_${sentenceNumber}_${rule.testNumber}Kt" }
|
||||||
).apply { putAll(baseSubstitutions) }
|
).apply { putAll(baseSubstitutions) }
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ class GenerationNotLinkedSpecTestDataConfig : GenerationSpecTestDataConfig() {
|
|||||||
|
|
||||||
override val layoutFilename = "notLinkedTestsLayout.kt"
|
override val layoutFilename = "notLinkedTestsLayout.kt"
|
||||||
override val substitutions = mutableMapOf<SubstitutionTag, (SubstitutionRule) -> String>(
|
override val substitutions = mutableMapOf<SubstitutionTag, (SubstitutionRule) -> String>(
|
||||||
SubstitutionTag.CATEGORIES to { _ -> categories.joinToString(", ") },
|
SubstitutionTag.CATEGORIES to { categories.joinToString(", ") },
|
||||||
SubstitutionTag.CLASS_OF_FILE to { rule -> "_${rule.testNumber}Kt" }
|
SubstitutionTag.CLASS_OF_FILE to { rule -> "_${rule.testNumber}Kt" }
|
||||||
).apply { putAll(baseSubstitutions) }
|
).apply { putAll(baseSubstitutions) }
|
||||||
|
|
||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.generators.templates
|
package org.jetbrains.kotlin.spec.utils.generators.templates
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.tasks.generateTests
|
import org.jetbrains.kotlin.spec.utils.tasks.generateTests
|
||||||
|
|
||||||
fun generationSpecTestDataConfigGroup(regenerateTests: Boolean = false, body: () -> Unit) {
|
fun generationSpecTestDataConfigGroup(regenerateTests: Boolean = false, body: () -> Unit) {
|
||||||
body()
|
body()
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.generators.templates
|
package org.jetbrains.kotlin.spec.utils.generators.templates
|
||||||
|
|
||||||
enum class TemplateValidationTransformerType {
|
enum class TemplateValidationTransformerType {
|
||||||
TRIM_BACKTICKS
|
TRIM_BACKTICKS
|
||||||
+8
-8
@@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.models
|
package org.jetbrains.kotlin.spec.utils.models
|
||||||
|
|
||||||
import org.jetbrains.kotlin.TestsExceptionType
|
import org.jetbrains.kotlin.TestsExceptionType
|
||||||
import org.jetbrains.kotlin.spec.*
|
import org.jetbrains.kotlin.spec.utils.*
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.issuesPattern
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.issuesPattern
|
||||||
import org.jetbrains.kotlin.spec.parsers.LinkedSpecTestPatterns.relevantPlacesPattern
|
import org.jetbrains.kotlin.spec.utils.parsers.LinkedSpecTestPatterns.relevantPlacesPattern
|
||||||
import org.jetbrains.kotlin.spec.parsers.TestCasePatterns.testCaseNumberPattern
|
import org.jetbrains.kotlin.spec.utils.parsers.TestCasePatterns.testCaseNumberPattern
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
+14
-14
@@ -1,21 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.models
|
package org.jetbrains.kotlin.spec.utils.models
|
||||||
|
|
||||||
import org.jetbrains.kotlin.TestsExceptionType
|
import org.jetbrains.kotlin.TestsExceptionType
|
||||||
import org.jetbrains.kotlin.spec.SpecTestCasesSet
|
import org.jetbrains.kotlin.spec.utils.SpecTestCasesSet
|
||||||
import org.jetbrains.kotlin.spec.SpecTestInfoElementType
|
import org.jetbrains.kotlin.spec.utils.SpecTestInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.TestArea
|
import org.jetbrains.kotlin.spec.utils.TestArea
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.ls
|
import org.jetbrains.kotlin.spec.utils.parsers.LinkedSpecTestPatterns.placePattern
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.withUnderscores
|
import org.jetbrains.kotlin.spec.utils.parsers.LinkedSpecTestPatterns.relevantPlacesPattern
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.splitByPathSeparator
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.withSpaces
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.withSpaces
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.withUnderscores
|
||||||
import org.jetbrains.kotlin.spec.parsers.LinkedSpecTestPatterns.placePattern
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.splitByPathSeparator
|
||||||
import org.jetbrains.kotlin.spec.parsers.LinkedSpecTestPatterns.relevantPlacesPattern
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.ls
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ data class SpecPlace(
|
|||||||
)
|
)
|
||||||
|
|
||||||
class LinkedSpecTest(
|
class LinkedSpecTest(
|
||||||
private val specVersion: String,
|
val specVersion: String,
|
||||||
testArea: TestArea,
|
testArea: TestArea,
|
||||||
testType: TestType,
|
testType: TestType,
|
||||||
val place: SpecPlace,
|
val place: SpecPlace,
|
||||||
+12
-12
@@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.models
|
package org.jetbrains.kotlin.spec.utils.models
|
||||||
|
|
||||||
import org.jetbrains.kotlin.TestsExceptionType
|
import org.jetbrains.kotlin.TestsExceptionType
|
||||||
import org.jetbrains.kotlin.spec.SpecTestCasesSet
|
import org.jetbrains.kotlin.spec.utils.SpecTestCasesSet
|
||||||
import org.jetbrains.kotlin.spec.SpecTestInfoElementType
|
import org.jetbrains.kotlin.spec.utils.SpecTestInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.TestArea
|
import org.jetbrains.kotlin.spec.utils.TestArea
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.splitByPathSeparator
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.sectionsInFilePattern
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.withUnderscores
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.withSpaces
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.withSpaces
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.withUnderscores
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.ls
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.splitByPathSeparator
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.sectionsInFilePattern
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.ls
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
+15
-13
@@ -1,19 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.parsers
|
package org.jetbrains.kotlin.spec.utils.parsers
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.*
|
import org.jetbrains.kotlin.spec.utils.SpecTestInfoElementContent
|
||||||
import org.jetbrains.kotlin.spec.SpecTestInfoElementContent
|
import org.jetbrains.kotlin.spec.utils.SpecTestInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.SpecTestLinkedType
|
import org.jetbrains.kotlin.spec.utils.SpecTestLinkedType
|
||||||
import org.jetbrains.kotlin.spec.models.*
|
import org.jetbrains.kotlin.spec.utils.TestFiles
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.testInfoElementPattern
|
import org.jetbrains.kotlin.spec.utils.models.*
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.testPathBaseRegexTemplate
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.testInfoElementPattern
|
||||||
import org.jetbrains.kotlin.spec.parsers.LinkedSpecTestPatterns.testInfoPattern
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.testPathBaseRegexTemplate
|
||||||
import org.jetbrains.kotlin.spec.parsers.TestCasePatterns.testCaseInfoPattern
|
import org.jetbrains.kotlin.spec.utils.parsers.LinkedSpecTestPatterns.testInfoPattern
|
||||||
import org.jetbrains.kotlin.spec.validators.*
|
import org.jetbrains.kotlin.spec.utils.parsers.TestCasePatterns.testCaseInfoPattern
|
||||||
|
import org.jetbrains.kotlin.spec.utils.validators.SpecTestValidationException
|
||||||
|
import org.jetbrains.kotlin.spec.utils.validators.SpecTestValidationFailedReason
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
@@ -52,7 +54,7 @@ object CommonParser {
|
|||||||
placeMatcher.group("sentenceNumber").toInt()
|
placeMatcher.group("sentenceNumber").toInt()
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun parseLinkedSpecTest(testFilePath: String, testFiles: TestFiles): LinkedSpecTest {
|
fun parseLinkedSpecTest(testFilePath: String, testFiles: TestFiles): LinkedSpecTest {
|
||||||
val parsedTestFile = parseTestInfo(testFilePath, testFiles, SpecTestLinkedType.LINKED)
|
val parsedTestFile = parseTestInfo(testFilePath, testFiles, SpecTestLinkedType.LINKED)
|
||||||
val testInfoElements = parsedTestFile.testInfoElements
|
val testInfoElements = parsedTestFile.testInfoElements
|
||||||
val placeMatcher = testInfoElements[LinkedSpecTestFileInfoElementType.PLACE]!!.additionalMatcher!!
|
val placeMatcher = testInfoElements[LinkedSpecTestFileInfoElementType.PLACE]!!.additionalMatcher!!
|
||||||
+21
-21
@@ -1,26 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.parsers
|
package org.jetbrains.kotlin.spec.utils.parsers
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.models.SpecTestCaseInfoElementType
|
import org.jetbrains.kotlin.spec.utils.SpecTestLinkedType
|
||||||
import org.jetbrains.kotlin.spec.SpecTestLinkedType
|
import org.jetbrains.kotlin.spec.utils.TestArea
|
||||||
import org.jetbrains.kotlin.spec.TestArea
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.models.SpecTestCaseInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.INTEGER_REGEX
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.ASTERISK_REGEX
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.SINGLE_LINE_COMMENT_REGEX
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.INTEGER_REGEX
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.ASTERISK_REGEX
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.MULTILINE_COMMENT_REGEX
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.directiveRegex
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.SECTIONS_IN_FILE_REGEX
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.MULTILINE_COMMENT_REGEX
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.SINGLE_LINE_COMMENT_REGEX
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.ps
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.directiveRegex
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.testAreaRegex
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.ps
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.testPathRegexTemplate
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.sectionsInPathRegex
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.testTypeRegex
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.testAreaRegex
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.withSpaces
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.withSpaces
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.SECTIONS_IN_FILE_REGEX
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.testPathRegexTemplate
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns.sectionsInPathRegex
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns.testTypeRegex
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ object CommonPatterns {
|
|||||||
const val INTEGER_REGEX = """[1-9]\d*"""
|
const val INTEGER_REGEX = """[1-9]\d*"""
|
||||||
const val SINGLE_LINE_COMMENT_REGEX = """\/\/\s*%s"""
|
const val SINGLE_LINE_COMMENT_REGEX = """\/\/\s*%s"""
|
||||||
const val ASTERISK_REGEX = """\*"""
|
const val ASTERISK_REGEX = """\*"""
|
||||||
const val SECTIONS_IN_FILE_REGEX = """[\w-]+(,\s+[\w-]+)*"""
|
const val SECTIONS_IN_FILE_REGEX = """[\w-\.]+(,\s+[\w-\.]+)*"""
|
||||||
const val MULTILINE_COMMENT_REGEX = """\/\*\s+?%s\s+\*\/(?:\n)*"""
|
const val MULTILINE_COMMENT_REGEX = """\/\*\s+?%s\s+\*\/(?:\n)*"""
|
||||||
|
|
||||||
val ls: String = System.lineSeparator()
|
val ls: String = System.lineSeparator()
|
||||||
@@ -44,7 +44,7 @@ object CommonPatterns {
|
|||||||
val testPathRegexTemplate = """$testPathBaseRegexTemplate$ps(?<testType>pos|neg)$ps%s$"""
|
val testPathRegexTemplate = """$testPathBaseRegexTemplate$ps(?<testType>pos|neg)$ps%s$"""
|
||||||
val issuesPattern: Pattern = Pattern.compile("""(KT-[1-9]\d*)(,\s*KT-[1-9]\d*)*""")
|
val issuesPattern: Pattern = Pattern.compile("""(KT-[1-9]\d*)(,\s*KT-[1-9]\d*)*""")
|
||||||
val sectionsInFilePattern: Pattern = Pattern.compile("""(?<sections>$SECTIONS_IN_FILE_REGEX)""")
|
val sectionsInFilePattern: Pattern = Pattern.compile("""(?<sections>$SECTIONS_IN_FILE_REGEX)""")
|
||||||
val sectionsInPathRegex = """(?<sections>(?:[\w-]+)(?:$ps[\w-]+)*?)"""
|
val sectionsInPathRegex = """(?<sections>(?:[\w-\.]+)(?:$ps[\w-\.]+)*?)"""
|
||||||
val packagePattern: Pattern = Pattern.compile("""(?:^|\n)package (?<packageName>.*?)(?:;|\n)""")
|
val packagePattern: Pattern = Pattern.compile("""(?:^|\n)package (?<packageName>.*?)(?:;|\n)""")
|
||||||
}
|
}
|
||||||
|
|
||||||
+13
-17
@@ -1,18 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.parsers
|
package org.jetbrains.kotlin.spec.utils.parsers
|
||||||
|
|
||||||
import org.jetbrains.kotlin.TestsExceptionType
|
import org.jetbrains.kotlin.TestsExceptionType
|
||||||
import org.jetbrains.kotlin.spec.*
|
import org.jetbrains.kotlin.spec.utils.*
|
||||||
import org.jetbrains.kotlin.spec.models.CommonInfoElementType
|
import org.jetbrains.kotlin.spec.utils.models.CommonInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.models.LinkedSpecTestFileInfoElementType
|
import org.jetbrains.kotlin.spec.utils.models.LinkedSpecTestFileInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.models.SpecTestCaseInfoElementType
|
import org.jetbrains.kotlin.spec.utils.models.SpecTestCaseInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.models.SpecTestInfoElements
|
import org.jetbrains.kotlin.spec.utils.models.SpecTestInfoElements
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.splitByComma
|
import org.jetbrains.kotlin.spec.utils.parsers.TestCasePatterns.testCaseInfoPattern
|
||||||
import org.jetbrains.kotlin.spec.parsers.TestCasePatterns.testCaseInfoPattern
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.splitByComma
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
private operator fun SpecTestCase.plusAssign(addTestCase: SpecTestCase) {
|
private operator fun SpecTestCase.plusAssign(addTestCase: SpecTestCase) {
|
||||||
@@ -47,11 +47,7 @@ private fun SpecTestCase.save(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun parseTestCases(testFiles: TestFiles): SpecTestCasesSet {
|
fun parseTestCases(testFiles: TestFiles): SpecTestCasesSet {
|
||||||
val testCasesSet = SpecTestCasesSet(
|
val testCasesSet = SpecTestCasesSet(mutableMapOf(), mutableMapOf(), mutableMapOf())
|
||||||
mutableMapOf<String, TestCasesByNumbers>(),
|
|
||||||
mutableMapOf<String, NavigableMap<Int, TestCasesByNumbers>>(),
|
|
||||||
mutableMapOf<Int, SpecTestCase>()
|
|
||||||
)
|
|
||||||
var rangeOffset = 0
|
var rangeOffset = 0
|
||||||
|
|
||||||
for ((filename, fileContent) in testFiles) {
|
for ((filename, fileContent) in testFiles) {
|
||||||
@@ -59,8 +55,8 @@ fun parseTestCases(testFiles: TestFiles): SpecTestCasesSet {
|
|||||||
var startFind = 0
|
var startFind = 0
|
||||||
|
|
||||||
if (!testCasesSet.byFiles.contains(filename)) {
|
if (!testCasesSet.byFiles.contains(filename)) {
|
||||||
testCasesSet.byFiles[filename] = mutableMapOf<Int, SpecTestCase>()
|
testCasesSet.byFiles[filename] = mutableMapOf()
|
||||||
testCasesSet.byRanges[filename] = TreeMap<Int, TestCasesByNumbers>()
|
testCasesSet.byRanges[filename] = TreeMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
val testCasesOfFile = testCasesSet.byFiles[filename]!!
|
val testCasesOfFile = testCasesSet.byFiles[filename]!!
|
||||||
+11
-10
@@ -1,19 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.parsers
|
package org.jetbrains.kotlin.spec.utils.parsers
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import org.jetbrains.kotlin.TestsExceptionType
|
import org.jetbrains.kotlin.TestsExceptionType
|
||||||
import org.jetbrains.kotlin.spec.*
|
import org.jetbrains.kotlin.spec.utils.*
|
||||||
import org.jetbrains.kotlin.spec.models.CommonInfoElementType
|
import org.jetbrains.kotlin.spec.utils.models.CommonInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.models.CommonSpecTestFileInfoElementType
|
import org.jetbrains.kotlin.spec.utils.models.CommonSpecTestFileInfoElementType
|
||||||
import org.jetbrains.kotlin.spec.models.SpecTestInfoElements
|
import org.jetbrains.kotlin.spec.utils.models.SpecTestInfoElements
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.withUnderscores
|
import org.jetbrains.kotlin.spec.utils.validators.SpecTestValidationException
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonParser.splitByComma
|
import org.jetbrains.kotlin.spec.utils.validators.SpecTestValidationFailedReason
|
||||||
import org.jetbrains.kotlin.spec.validators.*
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.splitByComma
|
||||||
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser.withUnderscores
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
data class ParsedTestFile(
|
data class ParsedTestFile(
|
||||||
+11
-11
@@ -1,22 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.tasks
|
package org.jetbrains.kotlin.spec.utils.tasks
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.TestArea
|
import org.jetbrains.kotlin.spec.utils.TestArea
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
import org.jetbrains.kotlin.spec.generators.templates.Feature
|
import org.jetbrains.kotlin.spec.utils.generators.templates.Feature
|
||||||
import org.jetbrains.kotlin.spec.generators.templates.generationLinkedSpecTestDataConfig
|
import org.jetbrains.kotlin.spec.utils.generators.templates.generationLinkedSpecTestDataConfig
|
||||||
import org.jetbrains.kotlin.spec.generators.templates.generationSpecTestDataConfigGroup
|
import org.jetbrains.kotlin.spec.utils.generators.templates.generationSpecTestDataConfigGroup
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
generationSpecTestDataConfigGroup(regenerateTests = true) {
|
generationSpecTestDataConfigGroup(regenerateTests = true) {
|
||||||
generationLinkedSpecTestDataConfig {
|
generationLinkedSpecTestDataConfig {
|
||||||
testArea = TestArea.PSI
|
testArea = TestArea.PSI
|
||||||
testType = TestType.NEGATIVE
|
testType = TestType.NEGATIVE
|
||||||
sections = listOf("constant-literals", "boolean-literals")
|
sections = listOf("expressions", "constant-literals", "boolean-literals")
|
||||||
paragraphNumber = 1
|
paragraphNumber = 1
|
||||||
sentenceNumber = 2
|
sentenceNumber = 2
|
||||||
sentence = "These are strong keywords which cannot be used as identifiers unless escaped."
|
sentence = "These are strong keywords which cannot be used as identifiers unless escaped."
|
||||||
@@ -27,7 +27,7 @@ fun main() {
|
|||||||
generationLinkedSpecTestDataConfig {
|
generationLinkedSpecTestDataConfig {
|
||||||
testArea = TestArea.PSI
|
testArea = TestArea.PSI
|
||||||
testType = TestType.POSITIVE
|
testType = TestType.POSITIVE
|
||||||
sections = listOf("constant-literals", "boolean-literals")
|
sections = listOf("expressions", "constant-literals", "boolean-literals")
|
||||||
paragraphNumber = 1
|
paragraphNumber = 1
|
||||||
sentenceNumber = 2
|
sentenceNumber = 2
|
||||||
sentence = "These are strong keywords which cannot be used as identifiers unless escaped."
|
sentence = "These are strong keywords which cannot be used as identifiers unless escaped."
|
||||||
@@ -38,7 +38,7 @@ fun main() {
|
|||||||
generationLinkedSpecTestDataConfig {
|
generationLinkedSpecTestDataConfig {
|
||||||
testArea = TestArea.CODEGEN_BOX
|
testArea = TestArea.CODEGEN_BOX
|
||||||
testType = TestType.POSITIVE
|
testType = TestType.POSITIVE
|
||||||
sections = listOf("constant-literals", "boolean-literals")
|
sections = listOf("expressions", "constant-literals", "boolean-literals")
|
||||||
paragraphNumber = 1
|
paragraphNumber = 1
|
||||||
sentenceNumber = 2
|
sentenceNumber = 2
|
||||||
sentence = "These are strong keywords which cannot be used as identifiers unless escaped."
|
sentence = "These are strong keywords which cannot be used as identifiers unless escaped."
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. 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.spec.utils.tasks
|
||||||
|
|
||||||
|
import com.google.gson.GsonBuilder
|
||||||
|
import com.google.gson.JsonArray
|
||||||
|
import com.google.gson.JsonElement
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import org.jetbrains.kotlin.generators.tests.generator.testGroup
|
||||||
|
import org.jetbrains.kotlin.spec.checkers.AbstractDiagnosticsTestSpec
|
||||||
|
import org.jetbrains.kotlin.spec.codegen.AbstractBlackBoxCodegenTestSpec
|
||||||
|
import org.jetbrains.kotlin.spec.parsing.AbstractParsingTestSpec
|
||||||
|
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH
|
||||||
|
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TEST_PATH
|
||||||
|
import org.jetbrains.kotlin.spec.utils.TestArea
|
||||||
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
|
import org.jetbrains.kotlin.spec.utils.models.LinkedSpecTest
|
||||||
|
import org.jetbrains.kotlin.spec.utils.models.SpecPlace
|
||||||
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonParser
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
private object TestsMapGenerator {
|
||||||
|
private const val LINKED_TESTS_PATH = "linked"
|
||||||
|
private const val TESTS_MAP_FILENAME = "testsMap.json"
|
||||||
|
|
||||||
|
private inline fun <reified T : JsonElement> JsonObject.getOrCreate(key: String): T {
|
||||||
|
if (!has(key)) {
|
||||||
|
add(key, T::class.java.newInstance())
|
||||||
|
}
|
||||||
|
return get(key) as T
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun JsonObject.getOrCreateSpecTestObject(specPlace: SpecPlace, testArea: TestArea, testType: TestType): JsonArray {
|
||||||
|
val sections = "${testArea.testDataPath}/$LINKED_TESTS_PATH/${specPlace.sections.joinToString("/")}"
|
||||||
|
val testsBySection = getOrCreate<JsonObject>(sections)
|
||||||
|
val testsByParagraph = testsBySection.getOrCreate<JsonObject>(specPlace.paragraphNumber.toString())
|
||||||
|
val testsByType = testsByParagraph.getOrCreate<JsonObject>(testType.type)
|
||||||
|
|
||||||
|
return testsByType.getOrCreate(specPlace.sentenceNumber.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getTestInfo(test: LinkedSpecTest) =
|
||||||
|
JsonObject().apply {
|
||||||
|
addProperty("specVersion", test.specVersion)
|
||||||
|
addProperty("casesNumber", test.cases.byNumbers.size)
|
||||||
|
addProperty("description", test.description)
|
||||||
|
addProperty(
|
||||||
|
"unexpectedBehaviour",
|
||||||
|
test.unexpectedBehavior || test.cases.byNumbers.any { it.value.unexpectedBehavior }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun buildTestsMapPerSection() {
|
||||||
|
val testsMap = JsonObject()
|
||||||
|
|
||||||
|
TestArea.values().forEach { testArea ->
|
||||||
|
File("$TESTDATA_PATH/${testArea.testDataPath}/$LINKED_TESTS_PATH").walkTopDown().forEach testFiles@ { file ->
|
||||||
|
if (!file.isFile || file.extension != "kt") return@testFiles
|
||||||
|
|
||||||
|
val (specTest, _) = CommonParser.parseSpecTest(file.canonicalPath, mapOf("main.kt" to file.readText()))
|
||||||
|
|
||||||
|
if (specTest is LinkedSpecTest) {
|
||||||
|
val testInfo = getTestInfo(specTest)
|
||||||
|
|
||||||
|
testsMap.getOrCreateSpecTestObject(specTest.place, specTest.testArea, specTest.testType).add(testInfo)
|
||||||
|
|
||||||
|
specTest.relevantPlaces?.forEach {
|
||||||
|
testsMap.getOrCreateSpecTestObject(it, specTest.testArea, specTest.testType).add(testInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val gson = GsonBuilder().setPrettyPrinting().create()
|
||||||
|
|
||||||
|
testsMap.keySet().forEach { testPath ->
|
||||||
|
File("$TESTDATA_PATH/$testPath/$TESTS_MAP_FILENAME").writeText(gson.toJson(testsMap.get(testPath)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun generateTests() {
|
||||||
|
testGroup(TEST_PATH, TESTDATA_PATH) {
|
||||||
|
testClass<AbstractDiagnosticsTestSpec> {
|
||||||
|
model("diagnostics", excludeDirs = listOf("helpers"))
|
||||||
|
}
|
||||||
|
testClass<AbstractParsingTestSpec> {
|
||||||
|
model("psi", testMethod = "doParsingTest", excludeDirs = listOf("helpers", "templates"))
|
||||||
|
}
|
||||||
|
testClass<AbstractBlackBoxCodegenTestSpec> {
|
||||||
|
model("codegen/box", excludeDirs = listOf("helpers", "templates"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
TestsMapGenerator.buildTestsMapPerSection()
|
||||||
|
generateTests()
|
||||||
|
}
|
||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.tasks
|
package org.jetbrains.kotlin.spec.utils.tasks
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.SpecTestLinkedType
|
import org.jetbrains.kotlin.spec.utils.SpecTestLinkedType
|
||||||
import org.jetbrains.kotlin.spec.utils.SpecTestsStatElement
|
import org.jetbrains.kotlin.spec.utils.SpecTestsStatElement
|
||||||
import org.jetbrains.kotlin.spec.utils.SpecTestsStatElementType
|
import org.jetbrains.kotlin.spec.utils.SpecTestsStatElementType
|
||||||
import org.jetbrains.kotlin.spec.utils.TestsStatisticCollector
|
import org.jetbrains.kotlin.spec.utils.TestsStatisticCollector
|
||||||
+7
-7
@@ -1,14 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.validators
|
package org.jetbrains.kotlin.spec.utils.validators
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.models.AbstractSpecTest
|
import org.jetbrains.kotlin.spec.utils.SpecTestLinkedType
|
||||||
import org.jetbrains.kotlin.spec.SpecTestLinkedType
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.models.AbstractSpecTest
|
||||||
import org.jetbrains.kotlin.spec.parsers.CommonPatterns
|
import org.jetbrains.kotlin.spec.utils.parsers.CommonPatterns
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
enum class SpecTestValidationFailedReason(val description: String) {
|
enum class SpecTestValidationFailedReason(val description: String) {
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. 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.spec.utils.validators
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.spec.utils.models.AbstractSpecTest
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class BlackBoxTestTypeValidator(
|
||||||
|
testDataFile: File,
|
||||||
|
private val testInfo: AbstractSpecTest
|
||||||
|
) : AbstractTestValidator(testInfo, testDataFile) {
|
||||||
|
override fun computeTestTypes() = mapOf(1 to testInfo.testType)
|
||||||
|
}
|
||||||
+6
-6
@@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.validators
|
package org.jetbrains.kotlin.spec.utils.validators
|
||||||
|
|
||||||
import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest
|
import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest
|
||||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||||
import org.jetbrains.kotlin.diagnostics.Severity
|
import org.jetbrains.kotlin.diagnostics.Severity
|
||||||
import org.jetbrains.kotlin.spec.models.AbstractSpecTest
|
import org.jetbrains.kotlin.spec.utils.TestCasesByNumbers
|
||||||
import org.jetbrains.kotlin.spec.TestCasesByNumbers
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.models.AbstractSpecTest
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class DiagnosticTestTypeValidator(
|
class DiagnosticTestTypeValidator(
|
||||||
+5
-5
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* Use of this source code is governed by the Apache 2.0 license 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.validators
|
package org.jetbrains.kotlin.spec.utils.validators
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiErrorElement
|
import com.intellij.psi.PsiErrorElement
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import org.jetbrains.kotlin.spec.TestType
|
import org.jetbrains.kotlin.spec.utils.TestType
|
||||||
import org.jetbrains.kotlin.spec.models.AbstractSpecTest
|
import org.jetbrains.kotlin.spec.utils.models.AbstractSpecTest
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class ParsingTestTypeValidator(
|
class ParsingTestTypeValidator(
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 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.spec.validators
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.spec.models.AbstractSpecTest
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
class BlackBoxTestTypeValidator(
|
|
||||||
testDataFile: File,
|
|
||||||
private val testInfo: AbstractSpecTest
|
|
||||||
) : AbstractTestValidator(testInfo, testDataFile) {
|
|
||||||
override fun computeTestTypes() = mapOf(1 to testInfo.testType)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user