Skip to content

Commit

Permalink
fix: helper::normalize_test_function_name when test_test_*
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Dec 5, 2024
1 parent 89f0e14 commit e280500
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ function helper::normalize_test_function_name() {
local original_function_name="${1-}"
local result

# Remove "test_" prefix
# Remove the first "test_" prefix, if present
result="${original_function_name#test_}"
# If no "test_" was removed (e.g., "testFoo"), remove the "test" prefix
if [[ "$result" == "$original_function_name" ]]; then
result="${original_function_name#test}"
fi
# Replace underscores with spaces
result="${result//_/ }"
# Remove "test" prefix
result="${result#test}"
# Capitalize the first letter
result="$(tr '[:lower:]' '[:upper:]' <<< "${result:0:1}")${result:1}"

Expand Down

0 comments on commit e280500

Please sign in to comment.