Use platform-independent line separator in jspecify tests handler
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ class JspecifyDiagnosticComplianceHandler(testServices: TestServices) : ClassicF
|
||||
val jspecifyMark = diagnosticsToJspecifyMarks.getValue(jspecifyMode)[metaInfo.diagnostic.factory] ?: continue
|
||||
val fileLines = ktFile.text.lines()
|
||||
val fileLinePositions =
|
||||
fileLines.map { it.length }.runningReduce { sumLength, length -> sumLength + length + System.lineSeparator().length }
|
||||
fileLines.map { it.length }.runningReduce { sumLength, length -> sumLength + length + 1 }
|
||||
val lineIndexToPasteJspecifyMark = fileLinePositions.indexOfLast { it < metaInfo.start }
|
||||
val positionToPasteJspecifyMark = fileLinePositions[lineIndexToPasteJspecifyMark]
|
||||
val offset = fileLines[lineIndexToPasteJspecifyMark + 1].takeWhile { it == ' ' }.length
|
||||
|
||||
+1
-1
@@ -14,6 +14,6 @@ class JspecifyMarksCleanupPreprocessor(testServices: TestServices) : SourceFileP
|
||||
|
||||
companion object {
|
||||
private val jspecifyMarks = diagnosticsToJspecifyMarks.values.map { it.values }.flatten().joinToString("|")
|
||||
private val regexToCleanup = Regex("""[ ]*// ($jspecifyMarks)(, ($jspecifyMarks))*${System.lineSeparator()}""")
|
||||
private val regexToCleanup = Regex("""[ ]*// ($jspecifyMarks)(, ($jspecifyMarks))*\n""")
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -87,8 +87,8 @@ abstract class AbstractForeignAnnotationsTestBase : AbstractKotlinCompilerTest()
|
||||
}
|
||||
|
||||
forTestsMatching("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/*") {
|
||||
// useFrontendHandlers(::JspecifyDiagnosticComplianceHandler)
|
||||
// useSourcePreprocessor(::JspecifyMarksCleanupPreprocessor)
|
||||
useFrontendHandlers(::JspecifyDiagnosticComplianceHandler)
|
||||
useSourcePreprocessor(::JspecifyMarksCleanupPreprocessor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ object MockLibraryUtil {
|
||||
add("-d")
|
||||
add(classesDir.path)
|
||||
|
||||
if (useJava9) {
|
||||
if (useJava9 && extraModulepath.isNotEmpty()) {
|
||||
add("--module-path")
|
||||
add(extraModulepath.joinToString(File.pathSeparator))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user