Skip to content

Commit 42a453e

Browse files
authored
Merge pull request #501 from TypedDevs/fix/500-assertion_failed-wrong-test-name-on-fail
Fix wrong assertion_failed name of test on failure
2 parents b192a0b + 7348860 commit 42a453e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
- Add tasks storage policy clarifying `.tasks/` (versioned) vs `.task/` (git-ignored)
99
- Include `set_test_title` helper in the single-file library
1010
- Fix lifecycle hooks capture-and-report flow errors
11-
- set_up
12-
- tear_down
13-
- set_up_before_script
14-
- tear_down_after_script
11+
- `set_up`
12+
- `tear_down`
13+
- `set_up_before_script`
14+
- `tear_down_after_script`
1515
- Fix false negative from `assert_have_been_called_with` with pipes
1616
- Fix preservation of trailing whitespace in final argument to `data_set`
1717
- Fix unbound variable error in `parse_data_provider_args` with `set -u`
18+
- Fix wrong assertion_failed name of test on failure
1819

1920
## [0.24.0](https://github.com/TypedDevs/bashunit/compare/0.23.0...0.24.0) - 2025-09-14
2021

src/bashunit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function bashunit::assertion_failed() {
1010
local failure_condition_message=${3:-"but got "}
1111

1212
local label
13-
label="$(helper::normalize_test_function_name "${FUNCNAME[1]}")"
13+
label="$(helper::normalize_test_function_name "${FUNCNAME[2]}")"
1414
state::add_assertions_failed
1515
console_results::print_failed_test "${label}" "${expected}" \
1616
"$failure_condition_message" "${actual}"

tests/functional/custom_asserts_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function test_assert_foo_passed() {
1212

1313
function test_assert_foo_failed() {
1414
assert_same\
15-
"$(console_results::print_failed_test "Assert foo" "foo" "but got " "bar")"\
15+
"$(console_results::print_failed_test "Assert foo failed" "foo" "but got " "bar")"\
1616
"$(assert_foo "bar")"
1717
}
1818

@@ -22,6 +22,6 @@ function test_assert_positive_number_passed() {
2222

2323
function test_assert_positive_number_failed() {
2424
assert_same\
25-
"$(console_results::print_failed_test "Assert positive number" "positive number" "got" "0")"\
25+
"$(console_results::print_failed_test "Assert positive number failed" "positive number" "got" "0")"\
2626
"$(assert_positive_number "0")"
2727
}

0 commit comments

Comments
 (0)