Fix test on unused import suppression
Before the fix for KT-7185, the file looked like:
package suppression
@file:Suppress("UnusedImport")
import java.io.* // unused
And it was parsed incorrectly, because @file: annotations
should come before package directive
But after fix, import directives started being parsed that lead
to wrong unused import (because suppression wasn't parsed still)
This commit is contained in:
+2
-1
@@ -1,3 +1,4 @@
|
||||
@file:Suppress("UnusedImport")
|
||||
package suppression
|
||||
|
||||
import java.io.* // unused
|
||||
import java.io.* // unused
|
||||
|
||||
@@ -94,7 +94,7 @@ abstract class AbstractInspectionTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
file.extension == "kt" -> {
|
||||
val text = FileUtil.loadFile(file, true)
|
||||
val fileText =
|
||||
if (text.startsWith("package"))
|
||||
if (text.lines().any { it.startsWith("package") })
|
||||
text
|
||||
else
|
||||
"package ${file.nameWithoutExtension};$text"
|
||||
|
||||
Reference in New Issue
Block a user