[Tests] Don't ignore expected file if diagnostic output is empty

Because of this, `checkDiagnosticFullText.fir.diag.txt` was
obsolete, because nothing was reported, but test was green.

^KT-62559
This commit is contained in:
Roman Efremov
2023-10-20 18:57:30 +02:00
committed by Space Team
parent fcc6f873c7
commit fa20eb73f2
2 changed files with 7 additions and 28 deletions
@@ -1,26 +0,0 @@
/jvm.kt:(106,113): warning: Annotation `@Ann()` is missing on actual declaration.
All annotations from expect 'class OnClass : Any' must be present with the same arguments on actual 'class OnClass : Any', otherwise they might behave incorrectly.
/jvm.kt:(154,162): warning: Annotation `@Ann()` is missing on actual declaration.
All annotations from expect 'fun onMember(): Unit' must be present with the same arguments on actual 'fun onMember(): Unit', otherwise they might behave incorrectly.
/jvm.kt:(212,224): warning: Annotation `@Ann()` is missing on actual declaration.
All annotations from expect 'class ViaTypealias : Any' must be present with the same arguments on actual 'class ViaTypealiasImpl : Any', otherwise they might behave incorrectly.
/jvm.kt:(317,340): warning: Annotation `@Ann()` is missing on actual declaration.
All annotations from expect 'fun foo(): Unit' must be present with the same arguments on actual 'fun foo(): Unit', otherwise they might behave incorrectly.
/jvm.kt:(405,421): warning: Annotation `@WithArg(s = String(str))` has different arguments on actual declaration: `@WithArg(s = String(other str))`.
All annotations from expect 'fun withDifferentArg(): Unit' must be present with the same arguments on actual 'fun withDifferentArg(): Unit', otherwise they might behave incorrectly.
/jvm.kt:(439,451): warning: Annotation `@Ann()` is missing on actual declaration.
All annotations from expect 'fun inValueParam(arg: String): Unit' must be present with the same arguments on actual 'fun inValueParam(arg: String): Unit', otherwise they might behave incorrectly.
/jvm.kt:(484,495): warning: Annotation `@Ann()` is missing on actual declaration.
All annotations from expect 'fun <T> inTypeParam(): Unit' must be present with the same arguments on actual 'fun <T> inTypeParam(): Unit', otherwise they might behave incorrectly.
/jvm.kt:(513,521): warning: Annotation `@PROPERTY_GETTER:Ann()` is missing on actual declaration.
All annotations from expect 'val onGetter: String get(): String' must be present with the same arguments on actual 'val onGetter: String get(): String', otherwise they might behave incorrectly.
/jvm.kt:(547,553): warning: Annotation `@Ann()` is missing on actual declaration.
All annotations from expect 'fun onType(param: @Ann() Any): Unit' must be present with the same arguments on actual 'fun onType(param: Any): Unit', otherwise they might behave incorrectly.
@@ -60,10 +60,15 @@ class FullDiagnosticsRenderer(private val directive: SimpleDirective) {
private val dumper: MultiModuleInfoDumper = MultiModuleInfoDumper(moduleHeaderTemplate = "// -- Module: <%s> --")
fun assertCollectedDiagnostics(testServices: TestServices, expectedExtension: String) {
if (dumper.isEmpty()) return
val resultDump = dumper.generateResultingDump()
if (directive !in testServices.moduleStructure.allDirectives) {
return
}
val testDataFile = testServices.moduleStructure.originalTestDataFiles.first()
val expectedFile = testDataFile.parentFile.resolve("${testDataFile.nameWithoutExtension.removeSuffix(".fir")}$expectedExtension")
if (dumper.isEmpty() && !expectedFile.exists()) {
return
}
val resultDump = dumper.generateResultingDump()
testServices.assertions.assertEqualsToFile(expectedFile, resultDump)
}