| 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
data_set does not preserve trailing whitespace present in the final argument passed to it.
How to reproduce
This test currently fails:
# @data_provider provide_value_with_trailing_whitespace
function test_trailing_whitespace_in_last_value_from_data_provider() {
local expected="$1"
local actual="$2"
assert_same "${expected}" "${actual}"
}
function provide_value_with_trailing_whitespace() {
# Each data_set is passed the same value twice (expected, actual) to verify preservation
data_set "value " "value "
data_set "value " "value "
}
Output:
bashunit - 0.24.0 | Tests: 2
FF
There were 2 failures:
|1) tests/functional/provider_test.sh:107
|✗ Failed: Trailing whitespace in last value from data provider
| Expected 'value '
| but got 'value'
|2) tests/functional/provider_test.sh:107
|✗ Failed: Trailing whitespace in last value from data provider
| Expected 'value '
| but got 'value '
Tests: 2 failed, 2 total
Assertions: 2 failed, 2 total
Some tests failed
Time taken: 217 ms
Expected behavior
Test should pass
Summary
data_setdoes not preserve trailing whitespace present in the final argument passed to it.How to reproduce
This test currently fails:
Output:
Expected behavior
Test should pass