Skip to content

Commit

Permalink
fix: skipped and incomplete tests on diff lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Dec 5, 2024
1 parent e72c8af commit d4a54e6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ function runner::run_test() {
local line="${subshell_output#*]}" # Remove everything before and including "]"

# Replace [failed] with a newline to split failure messages
line=$(echo "$line" | sed 's/\[failed\]/\n/g')
line=$(echo "$line" | sed -e 's/\[failed\]/\n/g' \
-e 's/\[skipped\]/\n/g' \
-e 's/\[incomplete\]/\n/g')

state::print_line "$type" "$line"

Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/bashunit_fail_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function test_bashunit_with_multiple_failing_tests() {
local test_file=./tests/acceptance/fixtures/test_bashunit_with_multiple_failing_tests.sh

# shellcheck disable=SC2317
assert_match_snapshot "$(./bashunit --no-parallel --env "$TEST_ENV_FILE" "$test_file" --simple)"
assert_match_snapshot "$(./bashunit --no-parallel --env "$TEST_ENV_FILE" "$test_file")"
# shellcheck disable=SC2317
assert_general_error "$(./bashunit --no-parallel --env "$TEST_ENV_FILE" "$test_file" --simple)"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ function test_assert_failing() {
assert_same 1 2
assert_same 3 4
}

function test_assert_todo_and_skip() {
todo "foo"
skip "bar"
}

function test_assert_skip_and_todo() {
skip "baz"
todo "yei"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
.F
Running ./tests/acceptance/fixtures/test_bashunit_with_multiple_failing_tests.sh
✓ Passed: Assert same
✗ Failed: Assert failing
Expected '1'
but got  '2'
✗ Failed: Assert failing
Expected '3'
but got  '4'
✒ Incomplete: Assert todo and skip foo
↷ Skipped: Assert todo and skip bar
↷ Skipped: Assert skip and todo baz
✒ Incomplete: Assert skip and todo yei

There was 1 failure:

Expand All @@ -10,9 +21,7 @@
| Expected '3'
| but got  '4'



Tests:  1 passed, 1 failed, 2 total
Assertions: 1 passed, 2 failed, 3 total
Tests:  1 passed, 0 skipped, 2 incomplete, 1 failed, 4 total
Assertions: 1 passed, 2 skipped, 2 incomplete, 2 failed, 7 total

 Some tests failed 

0 comments on commit d4a54e6

Please sign in to comment.