Problem
Passing a quoted command line where a command name belongs is rejected with advice on how to fix it. The advice does not work:
✗ Failed: Triggers the advice 'ls -l' is not a usable command name for mock; pass arguments after it, as in 'mock ls -l'
Following it literally:
✗ Error: Bare mock as advised line 3: mock: command not found
The public helpers are bashunit::mock, bashunit::spy and bashunit::mock_sequence. src/doubles/mock.sh:61 builds the message from a bare $fn — "mock", "mock_sequence", "spy" at the three call sites — so the suggested command does not exist. This is the rule the docs stress hardest about this API: "Helpers are namespaced, assertions are not. The unprefixed form is command not found, not an alias."
The example is also wrong for what it demonstrates
pass arguments after it, as in '<fn> ls -l' does not describe any of the three:
bashunit::spy takes a single command name; there are no arguments to pass after itbashunit::mock ls -l means "mock ls, with -l as the replacement body", not "mock ls -l"bashunit::mock_sequence expects answers after the command, not arguments
The user's actual mistake is quoting a command line as the name. What they need to hear is that the name is the command alone — mock/spy intercept the command however it is later called, and bashunit::mock already forwards the call's arguments to the replacement (verified: bashunit::mock ls echo hi then ls -l yields hi -l).
Suggested fix
Report the namespaced helper name, and use an example that is true for the caller — naming the command alone. Then execute the advice in the test rather than string-matching it, the same way #1222 does for install.sh, since that is what let this one survive.
Context
Found by sweeping every advice string in src/ and executing it, the technique that produced #1221. The rest came back clean: the one deprecation (bashunit test --assert → bashunit assert) warns while the old form still works and the suggested form works; Run 'bashunit <sub> --help' succeeds for all eight subcommands; every flag named in a message exists under the subcommand that names it (--baseline-tolerance under bench); and was never registered as a spy; call it first with 'bashunit::spy <name>' is correctly namespaced — which is what makes this one look like an oversight rather than a convention.
Problem
Passing a quoted command line where a command name belongs is rejected with advice on how to fix it. The advice does not work:
Following it literally:
The public helpers are
bashunit::mock,bashunit::spyandbashunit::mock_sequence.src/doubles/mock.sh:61builds the message from a bare$fn—"mock","mock_sequence","spy"at the three call sites — so the suggested command does not exist. This is the rule the docs stress hardest about this API: "Helpers are namespaced, assertions are not. The unprefixed form iscommand not found, not an alias."The example is also wrong for what it demonstrates
pass arguments after it, as in '<fn> ls -l'does not describe any of the three:bashunit::spytakes a single command name; there are no arguments to pass after itbashunit::mock ls -lmeans "mockls, with-las the replacement body", not "mockls -l"bashunit::mock_sequenceexpects answers after the command, not argumentsThe user's actual mistake is quoting a command line as the name. What they need to hear is that the name is the command alone — mock/spy intercept the command however it is later called, and
bashunit::mockalready forwards the call's arguments to the replacement (verified:bashunit::mock ls echo hithenls -lyieldshi -l).Suggested fix
Report the namespaced helper name, and use an example that is true for the caller — naming the command alone. Then execute the advice in the test rather than string-matching it, the same way #1222 does for
install.sh, since that is what let this one survive.Context
Found by sweeping every advice string in
src/and executing it, the technique that produced #1221. The rest came back clean: the one deprecation (bashunit test --assert→bashunit assert) warns while the old form still works and the suggested form works;Run 'bashunit <sub> --help'succeeds for all eight subcommands; every flag named in a message exists under the subcommand that names it (--baseline-toleranceunderbench); andwas never registered as a spy; call it first with 'bashunit::spy <name>'is correctly namespaced — which is what makes this one look like an oversight rather than a convention.