Skip to content

Commit 153d53f

Browse files
committed
refactor(runner): tighten assertion output filtering
1 parent 946fb05 commit 153d53f

2 files changed

Lines changed: 12 additions & 33 deletions

File tree

src/runner.sh

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -984,36 +984,6 @@ function bashunit::runner::is_simple_progress_output() {
984984
return 0
985985
}
986986

987-
function bashunit::runner::line_starts_with_result_marker() {
988-
local line="$1"
989-
local marker
990-
local -a result_markers
991-
result_markers=(
992-
"${_BASHUNIT_COLOR_PASSED}✓ Passed"
993-
"${_BASHUNIT_COLOR_FAILED}✗ Failed"
994-
"${_BASHUNIT_COLOR_FAILED}✗ Error"
995-
"${_BASHUNIT_COLOR_SKIPPED}↷ Skipped"
996-
"${_BASHUNIT_COLOR_INCOMPLETE}✒ Incomplete"
997-
"${_BASHUNIT_COLOR_SNAPSHOT}✎ Snapshot"
998-
"${_BASHUNIT_COLOR_RISKY}⚠ Risky"
999-
"✓ Passed"
1000-
"✗ Failed"
1001-
"✗ Error"
1002-
"↷ Skipped"
1003-
"✒ Incomplete"
1004-
"✎ Snapshot"
1005-
"⚠ Risky"
1006-
)
1007-
1008-
for marker in "${result_markers[@]}"; do
1009-
case "$line" in
1010-
"$marker"*) return 0 ;;
1011-
esac
1012-
done
1013-
1014-
return 1
1015-
}
1016-
1017987
function bashunit::runner::line_exists_in_output() {
1018988
local needle="$1"
1019989
local haystack="$2"
@@ -1039,9 +1009,6 @@ function bashunit::runner::extract_assertion_runtime_output() {
10391009
if bashunit::runner::is_simple_progress_output "$line"; then
10401010
continue
10411011
fi
1042-
if bashunit::runner::line_starts_with_result_marker "$line"; then
1043-
continue
1044-
fi
10451012

10461013
[ -n "$filtered_output" ] && filtered_output="$filtered_output"$'\n'
10471014
filtered_output="$filtered_output$line"

tests/unit/runner_test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,15 @@ function test_extract_assertion_runtime_output_keeps_user_output_after_status_ou
3535

3636
assert_same "diagnostic after pass" "$actual"
3737
}
38+
39+
function test_extract_assertion_runtime_output_keeps_user_output_that_looks_like_status_output() {
40+
local runtime_output
41+
runtime_output=$'✗ Failed: emitted by the code under test\n✗ Failed: Example'
42+
local rendered_assertion_output
43+
rendered_assertion_output="✗ Failed: Example"
44+
45+
local actual
46+
actual="$(bashunit::runner::extract_assertion_runtime_output "$runtime_output" "$rendered_assertion_output")"
47+
48+
assert_same "✗ Failed: emitted by the code under test" "$actual"
49+
}

0 commit comments

Comments
 (0)