[Test] Fix FileNotFoundException in removeDirectiveFromFile
This happened when a FIR test didn't have a .fir.kt file.
This commit is contained in:
committed by
Space Team
parent
59c61cdd07
commit
cfc5bb74ef
@@ -27,6 +27,8 @@ fun File.isDirectiveDefined(directive: String): Boolean = this.useLines { line -
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun File.removeDirectiveFromFile(directive: Directive) {
|
fun File.removeDirectiveFromFile(directive: Directive) {
|
||||||
|
if (!exists()) return
|
||||||
|
|
||||||
val directiveName = directive.name
|
val directiveName = directive.name
|
||||||
val directiveRegexp = "^// $directiveName(:.*)?$(\n)?".toRegex(RegexOption.MULTILINE)
|
val directiveRegexp = "^// $directiveName(:.*)?$(\n)?".toRegex(RegexOption.MULTILINE)
|
||||||
val text = readText()
|
val text = readText()
|
||||||
|
|||||||
Reference in New Issue
Block a user