Debugger tests: specify expression for evaluate expression test when test failed

This commit is contained in:
Natalia Ukhorskaya
2014-04-15 12:53:21 +04:00
parent fa482bca80
commit 084c72f91c
@@ -41,21 +41,21 @@ public abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestC
createDebugProcess(path) createDebugProcess(path)
onBreakpoint { onBreakpoint {
val exceptions = arrayListOf<Throwable>() val exceptions = linkedMapOf<String, Throwable>()
for ((i, expression) in expressions.withIndices()) { for ((i, expression) in expressions.withIndices()) {
try { try {
evaluate(expression, expectedResults[i]) evaluate(expression, expectedResults[i])
} }
catch (e: Throwable) { catch (e: Throwable) {
exceptions.add(e) exceptions.put(expression, e)
} }
} }
if (exceptions.notEmpty) { if (!exceptions.empty) {
for (exc in exceptions) { for (exc in exceptions.values()) {
exc.printStackTrace() exc.printStackTrace()
} }
throw AssertionError("Test failed:\n" + exceptions.map { it.getMessage() }.makeString("\n")) throw AssertionError("Test failed:\n" + exceptions.map { "expression: ${it.key}, exception: ${it.value.getMessage()}" }.makeString("\n"))
} }
} }
finish() finish()