Problem
Provider values are unescaped shell-style before reaching the test, which is
defensible on its own — the parser has deliberate handling for \t, \n and
$'…' from printf '%q'. What is not defensible is the last row:
function provider_shapes() {
echo 'plain'
echo 'mid\dle'
echo 'C:\'
echo 'two\\back'
}
| provider emits |
test receives |
| plain |
plain |
| mid\dle |
middle |
| C:\ |
<unset> |
| two\\back |
two\back |
A value ending in a lone backslash does not arrive at all: ${1-<unset>} shows
the argument is unset, so the test runs against nothing and passes or fails for
a reason unrelated to the data. Silent, like the assert_equals backslash bug
reported today in #1108.
Windows paths (C:\), a trailing path separator, or a regex fragment ending in
an escape all hit it.
Where it is
bashunit::runner::parse_data_provider_args alone returns C: for that input —
the trailing backslash is dropped but the argument survives:
input=[C:\] -> arg=[C:]
input=[ends-with-backslash\] -> arg=[ends-with-backslash]
So the parser loses the backslash and something downstream loses the whole
argument. Both halves want fixing; the second is the user-visible one.
Nothing in docs/data-providers.md describes escape handling, so there is also
a question of what the intended contract is: literal values, or shell-unescaped
ones. Whichever it is, an argument silently vanishing is not it.
Problem
Provider values are unescaped shell-style before reaching the test, which is
defensible on its own — the parser has deliberate handling for \t, \n and
$'…' from printf '%q'. What is not defensible is the last row:
A value ending in a lone backslash does not arrive at all: ${1-<unset>} shows
the argument is unset, so the test runs against nothing and passes or fails for
a reason unrelated to the data. Silent, like the assert_equals backslash bug
reported today in #1108.
Windows paths (C:\), a trailing path separator, or a regex fragment ending in
an escape all hit it.
Where it is
bashunit::runner::parse_data_provider_args alone returns C: for that input —
the trailing backslash is dropped but the argument survives:
So the parser loses the backslash and something downstream loses the whole
argument. Both halves want fixing; the second is the user-visible one.
Nothing in docs/data-providers.md describes escape handling, so there is also
a question of what the intended contract is: literal values, or shell-unescaped
ones. Whichever it is, an argument silently vanishing is not it.