in plugin-rust-agent/src/main/kotlin/jetbrains/buildServer/rust/logging/CargoTestingLogger.kt [31:79]
override fun processLine(text: String) {
val line = text.trim()
if (line == "failures:") {
myTestOutputName = null
return
}
val testMatcher = TEST_PATTERN.matcher(line)
if (testMatcher.find()) {
// Test result line
val testName = testMatcher.group(1).replace('\\', '/')
val result = testMatcher.group(2).lowercase()
myTestName = testName
val testDuration = System.currentTimeMillis() - myTestStartTime
when (result) {
"ok" -> {
myLogger.message(String.format(TEST_STARTED_FORMAT, testName))
myLogger.message(String.format(TEST_FINISHED_FORMAT, testName, testDuration))
}
"ignored" -> {
myLogger.message(String.format(TEST_IGNORED_FORMAT, testName, ""))
}
"failed" -> {
myFailedTests.set(testName, Pair(testDuration, StringBuilder()))
}
else -> {
myLogger.message(String.format(TEST_STDOUT_FORMAT, myTestName, escapeValue(line)))
}
}
myTestStartTime = System.currentTimeMillis()
} else {
val outputMatcher = TEST_STDOUT_PATTERN.matcher(line)
if (outputMatcher.find()) {
// Test output line
val testName = outputMatcher.group(1)
if (myFailedTests.containsKey(testName) == true) {
myTestOutputName = testName
return
}
}
if (!myTestOutputName.isNullOrEmpty()) {
val pair = myFailedTests.get(myTestOutputName!!)
pair?.second?.append(line)?.append("\n")
}
}
}