[skip ci] improve output for returned result
This commit is contained in:
parent
b625d338e6
commit
d6d7c5d5bb
2 changed files with 7 additions and 4 deletions
src
main/kotlin/org/domaindrivenarchitecture/provs/framework/core
test/kotlin/org/domaindrivenarchitecture/provs/framework/core
|
@ -326,7 +326,10 @@ open class Prov protected constructor(
|
|||
ProvResult(false, err = "mode unknown")
|
||||
}
|
||||
|
||||
val resultValueWithCmdCleanedUp = returnValue.copy(cmd = returnValue.cmd?.replace("[" + SHELL + ", -c, ", "["))
|
||||
// removes potential prefix from cmd in ProvResult, e.g. removes "/bin/bash -c "
|
||||
fun cleanedResult(result: ProvResult): ProvResult { return result.copy(cmd = returnValue.cmd?.replace("[" + SHELL + ", -c, ", "[")) }
|
||||
|
||||
val resultValueWithCmdCleanedUp = cleanedResult(returnValue)
|
||||
internalResults[resultIndex].provResult = resultValueWithCmdCleanedUp
|
||||
|
||||
// Add failure result to output if not yet included,
|
||||
|
@ -335,7 +338,7 @@ open class Prov protected constructor(
|
|||
// whereas the failure results may have a useful error message, which should be in the output.
|
||||
// Only direct result objects are added, but not result objects that were passed from a subtask as they are already handled in the subtask.
|
||||
if (!resultOfTaskLambda.success && (resultIndex < internalResults.size - 1) && (resultOfTaskLambda != internalResults[resultIndex + 1].provResult)) {
|
||||
internalResults.add(ResultLine(level + 1, "<<returned result>>", resultOfTaskLambda))
|
||||
internalResults.add(ResultLine(level + 1, name + " (returned result)", cleanedResult(resultOfTaskLambda)))
|
||||
}
|
||||
|
||||
if (level == 0) {
|
||||
|
|
|
@ -362,7 +362,7 @@ internal class ProvTest {
|
|||
"---> \u001B[91mFAILED\u001B[0m -- testMethodForOutputTest_nested_with_failure \n" +
|
||||
"------> \u001B[91mFAILED\u001B[0m -- sub1 \n" +
|
||||
"---------> \u001B[92mSuccess\u001B[0m -- testMethodForOutputTest_nested_with_failure \n" +
|
||||
"---------> \u001B[91mFAILED\u001B[0m -- <<returned result>> -- Error: Iamanerrormessage\n" +
|
||||
"---------> \u001B[91mFAILED\u001B[0m -- sub1 (returned result) -- Error: Iamanerrormessage\n" +
|
||||
"------> \u001B[92mSuccess\u001B[0m -- cmd [echo -End test-]\n" +
|
||||
"----------------------------------------------------------------------------------------------------\n" +
|
||||
"Overall > \u001B[91mFAILED\u001B[0m \n" +
|
||||
|
@ -734,7 +734,7 @@ internal class ProvTest {
|
|||
"------> \u001B[92mSuccess\u001B[0m -- sub2e-task \n" +
|
||||
"---------> \u001B[92mSuccess\u001B[0m -- addResultToEval \n" +
|
||||
"------> \u001B[91mFAILED\u001B[0m -- sub2f-taskWithResult -- Error: returned-result - error msg C should be once in output - at the end of sub3taskWithResult \n" +
|
||||
"------> \u001B[91mFAILED\u001B[0m -- <<returned result>> -- Error: returned-result - error msg D should be once in output - at the end of sub1 \n" +
|
||||
"------> \u001B[91mFAILED\u001B[0m -- sub1 (returned result) -- Error: returned-result - error msg D should be once in output - at the end of sub1 \n" +
|
||||
"----------------------------------------------------------------------------------------------------\n" +
|
||||
"Overall > \u001B[91mFAILED\u001B[0m \n" +
|
||||
"============================================ SUMMARY END ===========================================\n" +
|
||||
|
|
Loading…
Add table
Reference in a new issue