diff --git a/atrium-core/src/commonMain/kotlin/ch/tutteli/atrium/reporting/prerendering/text/impl/DefaultUsageHintGroupTextPreRenderer.kt b/atrium-core/src/commonMain/kotlin/ch/tutteli/atrium/reporting/prerendering/text/impl/DefaultUsageHintGroupTextPreRenderer.kt index eba28f717d..4df926a5ee 100644 --- a/atrium-core/src/commonMain/kotlin/ch/tutteli/atrium/reporting/prerendering/text/impl/DefaultUsageHintGroupTextPreRenderer.kt +++ b/atrium-core/src/commonMain/kotlin/ch/tutteli/atrium/reporting/prerendering/text/impl/DefaultUsageHintGroupTextPreRenderer.kt @@ -12,6 +12,7 @@ internal class DefaultUsageHintGroupTextPreRenderer : TypedTextPreRenderer { + if (controlObject.explainsProof) return emptyList() val newControlObject = controlObject.copy(prefix = Icon.BULB, indentLevel = controlObject.indentLevel + 1) return OutputNode.singleWithoutColumnsNotOwnLevel(children = reportable.children.flatMap { child -> controlObject.transformChildIncludingIndentationAndPrefix(child, newControlObject) diff --git a/atrium-core/src/commonTest/kotlin/ch/tutteli/atrium/reporting/CreateReportTest.kt b/atrium-core/src/commonTest/kotlin/ch/tutteli/atrium/reporting/CreateReportTest.kt index 59bf335fb0..205afabc27 100644 --- a/atrium-core/src/commonTest/kotlin/ch/tutteli/atrium/reporting/CreateReportTest.kt +++ b/atrium-core/src/commonTest/kotlin/ch/tutteli/atrium/reporting/CreateReportTest.kt @@ -764,6 +764,73 @@ class CreateReportTest { ) } + @Test + fun proofExplanation_With_UsageHint() { + val builder = buildRootGroup { + proofGroup(Text("not to contain"), Text.EMPTY) { + invisibleFailingProofGroup { + proofExplanation { + simpleProof(Text("to be greater than"), 2) { false } + usageHintGroup { + add(ErrorMessages.FORGOT_DO_DEFINE_EXPECTATION) + addAll(defaultHintsAtLeastOneExpectationDefined) + } + } + } + } + } + + expectForReporterWithoutAnsi( + builder, + """ + |a verb : "representation" + |(f) not to contain :${' '} + | » to be greater than : 2 + """.trimMargin() + ) + + expectForReporterWithAnsi( + builder, + """ + |a verb : "representation" + |$x not to contain :${' '} + | » to be greater than : 2 + """.trimMargin() + ) + } + @Test + fun proofExplanation_With_UsageHint_Not_As_Direct_Child() { + + val builder = buildRootGroup { + + proofGroup(Text("Elements need all"), Text.EMPTY){ + invisibleFailingProofGroup { + proofExplanation { + feature(Text("password"), Text("should not be shown")) { + simpleProof(Text("not to equal"), "qwerty") { false } + usageHintGroup { + add(ErrorMessages.FORGOT_DO_DEFINE_EXPECTATION) + addAll(defaultHintsAtLeastOneExpectationDefined) + } + + + } + } + } + } + } + expectForReporterWithoutAnsi( + builder, + """ + |a verb : "representation" + |(f) Elements need all :${' '} + | » > password :${' '} + | • not to equal : "qwerty" + """.trimMargin() + + ) + } + @Test fun row_withIconAndWithoutBorder() { val builder = buildRootGroup {