mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Kotlin: Provide a way for tests to cause an exception
This commit is contained in:
@@ -50,6 +50,15 @@ open class KotlinFileExtractor(
|
||||
val pkgId = extractPackage(pkg)
|
||||
tw.writeHasLocation(id, locId)
|
||||
tw.writeCupackage(id, pkgId)
|
||||
|
||||
val exceptionOnFile = System.getenv("CODEQL_KOTLIN_INTERNAL_EXCEPTION_WHILE_EXTRACTING_FILE")
|
||||
if(exceptionOnFile != null) {
|
||||
@OptIn(kotlin.ExperimentalStdlibApi::class) // Annotation required by kotlin versions < 1.5
|
||||
if(exceptionOnFile.lowercase() == file.name.lowercase()) {
|
||||
throw Exception("Internal testing exception")
|
||||
}
|
||||
}
|
||||
|
||||
file.declarations.map { extractDeclaration(it) }
|
||||
CommentExtractor(this, file, tw.fileId).extract()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user