improve layout of result line for FAILED results
This commit is contained in:
parent
a00f0e9de0
commit
14690a089d
3 changed files with 7 additions and 7 deletions
|
@ -418,7 +418,7 @@ internal data class ResultLine(val level: Int, val method: String?, var provResu
|
|||
override fun toString(): String {
|
||||
val provResult = provResult
|
||||
return if (provResult != null) {
|
||||
prefix(level) + (if (provResult.success) "Success -- " else "FAILED -- ") +
|
||||
prefix(level) + (if (provResult.success) "Success -- " else "FAILED -- ") +
|
||||
method + " " + (provResult.cmd ?: "") +
|
||||
(if (!provResult.success && provResult.err != null) " -- Error: " + provResult.err.escapeControlChars() else "")
|
||||
} else
|
||||
|
|
|
@ -4,11 +4,11 @@ package org.domaindrivenarchitecture.provs.framework.core
|
|||
/**
|
||||
* Repeats task until it returns success
|
||||
*/
|
||||
fun Prov.repeatTaskUntilSuccess(times: Int, sleepInSec: Int, func: Prov.() -> ProvResult) = requireLast {
|
||||
fun Prov.repeatTaskUntilSuccess(times: Int, sleepInSec: Int, task: Prov.() -> ProvResult) = requireLast {
|
||||
require(times > 0)
|
||||
var result = ProvResult(false, err = "Internal error") // Will only be returned if function is not executed at all, otherwise func's last result is returned
|
||||
for (i in 1..times) {
|
||||
result = func()
|
||||
result = task()
|
||||
if (result.success)
|
||||
return@requireLast result
|
||||
Thread.sleep(sleepInSec * 1000L)
|
||||
|
|
|
@ -305,7 +305,7 @@ internal class ProvTest {
|
|||
val expectedOutput =
|
||||
"============================================== SUMMARY (test instance with no progress info) ============================================== \n" +
|
||||
"> \u001B[92mSuccess\u001B[0m -- methodThatProvidesSomeOutput (requireLast) \n" +
|
||||
"---> \u001B[93mFAILED\u001B[0m -- checkPrereq_evaluateToFailure (requireLast) -- Error: This is a test error.\n" +
|
||||
"---> \u001B[93mFAILED\u001B[0m -- checkPrereq_evaluateToFailure (requireLast) -- Error: This is a test error.\n" +
|
||||
"---> \u001B[92mSuccess\u001B[0m -- sh \n" +
|
||||
"------> \u001B[92mSuccess\u001B[0m -- cmd [/bin/bash, -c, echo -Start test-]\n" +
|
||||
"------> \u001B[92mSuccess\u001B[0m -- cmd [/bin/bash, -c, echo Some output]\n" +
|
||||
|
@ -346,7 +346,7 @@ internal class ProvTest {
|
|||
|
||||
val expectedOutput =
|
||||
"============================================== SUMMARY (test instance with no progress info) ============================================== \n" +
|
||||
"> \u001B[91mFAILED\u001B[0m -- checkPrereq_evaluateToFailure (requireLast) -- Error: This is a test error.\n" +
|
||||
"> \u001B[91mFAILED\u001B[0m -- checkPrereq_evaluateToFailure (requireLast) -- Error: This is a test error.\n" +
|
||||
"============================================ SUMMARY END ============================================ \n" +
|
||||
"\n"
|
||||
|
||||
|
@ -384,8 +384,8 @@ internal class ProvTest {
|
|||
|
||||
val expectedOutput =
|
||||
"============================================== SUMMARY (test instance with no progress info) ============================================== \n" +
|
||||
"> \u001B[92mSuccess\u001B[0m -- prov_prints_correct_output_for_failure_not_taken_into_account (requireLast) \n" +
|
||||
"---> \u001B[93mFAILED\u001B[0m -- checkPrereq_evaluateToFailure (requireLast) -- Error: This is a test error.\n" +
|
||||
"> \u001B[92mSuccess\u001B[0m -- prov_prints_correct_output_for_failure_that_is_not_taken_into_account (requireLast) \n" +
|
||||
"---> \u001B[93mFAILED\u001B[0m -- checkPrereq_evaluateToFailure (requireLast) -- Error: This is a test error.\n" +
|
||||
"---> \u001B[92mSuccess\u001B[0m -- returns success \n" +
|
||||
"----------------------------------------------------------------------------------------------------- \n" +
|
||||
"Overall > \u001B[92mSuccess\u001B[0m\n" +
|
||||
|
|
Loading…
Reference in a new issue