Skip to content

Test function names are not interpolated when test fails #499

@mattness

Description

@mattness
Q A
OS macOS and Linux
Shell & version bash 5.3.3 (macOS) and bash 5.2.32 (Linux)
bashunit version 0.24.0 (both)

Summary

When a parameterized test with placeholder tokens in its function name does not pass, the token(s) are not replaced when the failure is output to the console.

How to reproduce

This test fails on purpose to demonstrate the incorrect output:

function __foo() {
  data_set 10
  data_set 4
}

# @data_provider __foo
function test_::1::_is_greater_than_5() {
  assert_greater_than 5 "${1}"
}

Output:

bashunit - 0.24.0 | Tests: 2
Running interp_test.sh
✓ Passed: '10' is greater than 5                                           29 ms
✗ Failed: ::1:: is greater than 5
    Expected '4'
    to be greater than '5'

There was 1 failure:

|1) interp_test.sh:7
|✗ Failed: ::1:: is greater than 5
|    Expected '4'
|    to be greater than '5'

Tests:      1 passed, 1 failed, 2 total
Assertions: 1 passed, 1 failed, 2 total

 Some tests failed
Time taken: 205 ms

Expected behavior

-Failed: ::1:: is greater than 5
+Failed: '4' is greater than 5

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions