Prepare spec tests for FIR version

This commit is contained in:
Denis Zharkov
2020-04-14 11:49:36 +03:00
parent 13efabc764
commit 26cb0ba144
4 changed files with 318 additions and 312 deletions
File diff suppressed because it is too large Load Diff
@@ -51,7 +51,7 @@ object TestsJsonMapGenerator {
TestArea.values().forEach { testArea ->
File("${GeneralConfiguration.SPEC_TESTDATA_PATH}/${testArea.testDataPath}/$LINKED_TESTS_PATH").walkTopDown()
.forEach testFiles@{ file ->
if (!file.isFile || file.extension != "kt") return@testFiles
if (!file.isFile || file.extension != "kt" || file.name.endsWith(".fir.kt")) return@testFiles
val (specTest, _) = CommonParser.parseSpecTest(file.canonicalPath, mapOf("main.kt" to file.readText()))
@@ -55,7 +55,7 @@ interface BasePatterns {
}
object NotLinkedSpecTestPatterns : BasePatterns {
private const val FILENAME_REGEX = """(?<testNumber>$INTEGER_REGEX)\.kt"""
private const val FILENAME_REGEX = """(?<testNumber>$INTEGER_REGEX)(?:\.fir)?\.kt"""
override val pathPartRegex = SpecTestLinkedType.NOT_LINKED.testDataPath + ps + sectionsInPathRegex
override val testPathPattern: Pattern =
@@ -65,7 +65,7 @@ object NotLinkedSpecTestPatterns : BasePatterns {
}
object LinkedSpecTestPatterns : BasePatterns {
private const val FILENAME_REGEX = """(?<sentenceNumber>$INTEGER_REGEX)\.(?<testNumber>$INTEGER_REGEX)\.kt"""
private const val FILENAME_REGEX = """(?<sentenceNumber>$INTEGER_REGEX)\.(?<testNumber>$INTEGER_REGEX)(?:\.fir)?\.kt"""
override val pathPartRegex =
"""${SpecTestLinkedType.LINKED.testDataPath}$ps$sectionsInPathRegex${ps}p-(?<paragraphNumber>$INTEGER_REGEX)"""
@@ -35,9 +35,15 @@ fun detectDirsWithTestsMapFileOnly(dirName: String): List<String> {
}
fun generateTests() {
val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
testGroup(SPEC_TEST_PATH, SPEC_TESTDATA_PATH) {
testClass<AbstractDiagnosticsTestSpec> {
model("diagnostics", excludeDirs = listOf("helpers") + detectDirsWithTestsMapFileOnly("diagnostics"))
model(
"diagnostics",
excludeDirs = listOf("helpers") + detectDirsWithTestsMapFileOnly("diagnostics"),
excludedPattern = excludedFirTestdataPattern
)
}
testClass<AbstractParsingTestSpec> {
model(