improve output layout for info texts

merge-requests/1/merge
ansgarz 2 years ago
parent f47a8a4986
commit bcd43a95be

@ -345,13 +345,14 @@ open class Prov protected constructor(
private val ANSI_BRIGHT_RED = "\u001B[91m"
private val ANSI_BRIGHT_YELLOW = "\u001B[93m"
private val ANSI_BRIGHT_GREEN = "\u001B[92m"
private val ANSI_BRIGHT_BLUE = "\u001B[94m"
private val ANSI_GRAY = "\u001B[90m"
private fun printResults() {
println(
"============================================== SUMMARY " +
(if (instanceName != null) "(" + instanceName + ") " else "") +
"============================================== "
"============================================="
)
val successPerLevel = arrayListOf<Boolean>()
for (result in internalResults) {
@ -370,11 +371,11 @@ open class Prov protected constructor(
println(result.toString().escapeControlChars().formattedAsResultLine(successOfLevelsAbove))
}
if (internalResults.size > 1) {
println("----------------------------------------------------------------------------------------------------- ")
println("----------------------------------------------------------------------------------------------------")
println("Overall " + internalResults[0].toString().take(10).formattedAsResultLine())
}
printInfoTexts()
println("============================================ SUMMARY END ============================================ " + newline())
println("============================================ SUMMARY END ===========================================" + newline())
}
private fun levelsAboveContainsSuccess(successPerLevel: ArrayList<Boolean>, currentLevel: Int): Boolean {
@ -423,7 +424,7 @@ open class Prov protected constructor(
private fun printInfoTexts() {
if (infoTexts.isNotEmpty()) {
println("----------------------------------------------------------------------------------------------------- ")
println("+++++++++++++++++++++++++++++++++++ ${ANSI_BRIGHT_BLUE}Additional information$ANSI_RESET +++++++++++++++++++++++++++++++++++++++")
for (text in infoTexts) {
println(text)
}

@ -301,7 +301,7 @@ internal class ProvTest {
println(outContent.toString())
val expectedOutput =
"============================================== SUMMARY (test instance with no progress info) ============================================== \n" +
"============================================== 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[92mSuccess\u001B[0m -- sh \n" +
@ -309,9 +309,9 @@ internal class ProvTest {
"------> \u001B[92mSuccess\u001B[0m -- cmd [/bin/bash, -c, echo Some output]\n" +
"---> \u001B[92mSuccess\u001B[0m -- sh \n" +
"------> \u001B[92mSuccess\u001B[0m -- cmd [/bin/bash, -c, echo -End test-]\n" +
"----------------------------------------------------------------------------------------------------- \n" +
"----------------------------------------------------------------------------------------------------\n" +
"Overall > \u001B[92mSuccess\u001B[0m\n" +
"============================================ SUMMARY END ============================================ \n" +
"============================================ SUMMARY END ===========================================\n" +
"\n"
assertEquals(expectedOutput, outContent.toString().replace("\r", ""))
@ -343,9 +343,9 @@ internal class ProvTest {
println(outContent.toString())
val expectedOutput =
"============================================== SUMMARY (test instance with no progress info) ============================================== \n" +
"============================================== SUMMARY (test instance with no progress info) =============================================\n" +
"> \u001B[91mFAILED\u001B[0m -- checkPrereq_evaluateToFailure (requireLast) -- Error: This is a test error.\n" +
"============================================ SUMMARY END ============================================ \n" +
"============================================ SUMMARY END ===========================================\n" +
"\n"
assertEquals(expectedOutput, outContent.toString().replace("\r", ""))
@ -384,14 +384,14 @@ internal class ProvTest {
println(outContent.toString())
val expectedOutput =
"============================================== SUMMARY (test instance with no progress info) ============================================== \n" +
"============================================== SUMMARY (test instance with no progress info) =============================================\n" +
"> \u001B[92mSuccess\u001B[0m -- taskA \n" +
"---> \u001B[92mSuccess\u001B[0m -- prov_marks_failed_output_yellow_if_optional (optional) \n" +
"------> \u001B[93mFAILED\u001B[0m -- taskB \n" +
"---------> \u001B[93mFAILED\u001B[0m -- taskC \n" +
"----------------------------------------------------------------------------------------------------- \n" +
"----------------------------------------------------------------------------------------------------\n" +
"Overall > \u001B[92mSuccess\u001B[0m\n" +
"============================================ SUMMARY END ============================================ \n" +
"============================================ SUMMARY END ===========================================\n" +
"\n"
assertEquals(expectedOutput, outContent.toString().replace("\r", ""))
@ -454,12 +454,12 @@ internal class ProvTest {
println(outContent.toString())
val expectedOutput =
"============================================== SUMMARY (test instance) ============================================== \n" +
"============================================== SUMMARY (test instance) =============================================\n" +
"> \u001B[92mSuccess\u001B[0m -- TaskB \n" +
"---> \u001B[92mSuccess\u001B[0m -- taskC \n" +
"----------------------------------------------------------------------------------------------------- \n" +
"----------------------------------------------------------------------------------------------------\n" +
"Overall > \u001B[92mSuccess\u001B[0m\n" +
"============================================ SUMMARY END ============================================ \n" +
"============================================ SUMMARY END ===========================================\n" +
"\n"
assertEquals(expectedOutput, outContent.toString().replace("\r", ""))
@ -618,13 +618,13 @@ internal class ProvTest {
println(outContent.toString())
val expectedOutput =
"============================================== SUMMARY (test instance with no progress info) ============================================== \n" +
"============================================== SUMMARY (test instance with no progress info) =============================================\n" +
"> \u001B[92mSuccess\u001B[0m -- infoText_is_printed_correctly \n" +
"----------------------------------------------------------------------------------------------------- \n" +
"+++++++++++++++++++++++++++++++++++ \u001B[94mAdditional information\u001B[0m +++++++++++++++++++++++++++++++++++++++\n" +
"Text1\n" +
"Text2\n" +
"with newline\n" +
"============================================ SUMMARY END ============================================ \n" +
"============================================ SUMMARY END ===========================================\n" +
"\n"
assertEquals(expectedOutput, outContent.toString().replace("\r", ""))

Loading…
Cancel
Save