Fail per file check on first exception

This commit is contained in:
Simon Ogorodnik
2018-04-04 13:18:05 +03:00
parent c8fbf2d3ac
commit 1a015402c8
@@ -82,21 +82,21 @@ class AllKotlinInspectionTest : DaemonAnalyzerTestCase() {
val errors = mutableListOf<Throwable>() val errors = mutableListOf<Throwable>()
profileTools.forEach { for (it in profileTools) {
val localInspectionTool = it.tool.tool as? LocalInspectionTool ?: return@forEach val localInspectionTool = it.tool.tool as? LocalInspectionTool ?: continue
if (it.tool.language !in setOf(null, "kotlin", "UAST")) return@forEach if (it.tool.language !in setOf(null, "kotlin", "UAST")) continue
val result = measureNanoTime { val result = measureNanoTime {
try { try {
localInspectionTool.analyze(psiFile) localInspectionTool.analyze(psiFile)
} catch (t: Throwable) { } catch (t: Throwable) {
val myEx = ExceptionWhileInspection(it.tool.id, t) val myEx = ExceptionWhileInspection(it.tool.id, t)
myEx.printStackTrace() myEx.printStackTrace()
errors += myEx errors += myEx
} }
} }
results[it.tool.id] = result results[it.tool.id] = result
totalNs += result totalNs += result
if (errors.isNotEmpty()) break
} }
return PerFileTestResult(results, totalNs, errors) return PerFileTestResult(results, totalNs, errors)