cli-test: Add placeholder for executable extension
Help text generated by `clap` contains the full file name (including extension) of the binary. On Unix-like systems, binaries commonly do not have any file extension. On Windows, ".exe" is common. To allow testing such output, introduce a new marker "[EXE]" that is substituted accordingly. The idea and syntax is taken from https://docs.rs/trycmd/1.0.0/trycmd/#toml
This commit is contained in:
parent
e831aeb57b
commit
9055a2043c
|
|
@ -481,6 +481,16 @@ impl TestFormula {
|
||||||
let assert = OutputAssert::new(output).with_assert(assert.clone());
|
let assert = OutputAssert::new(output).with_assert(assert.clone());
|
||||||
let expected = Self::map_spaced_brackets(&assertion.expected);
|
let expected = Self::map_spaced_brackets(&assertion.expected);
|
||||||
|
|
||||||
|
let expected = {
|
||||||
|
#[cfg(windows)]
|
||||||
|
const EXE: &str = ".exe";
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
const EXE: &str = "";
|
||||||
|
|
||||||
|
expected.replace("[EXE]", EXE)
|
||||||
|
};
|
||||||
|
|
||||||
let matches = if test.stderr {
|
let matches = if test.stderr {
|
||||||
assert.stderr_matches(&expected)
|
assert.stderr_matches(&expected)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Do you have feedback?
|
||||||
- Mail <feedback@radicle.xyz>
|
- Mail <feedback@radicle.xyz>
|
||||||
(Messages are automatically posted to the public #feedback channel on Zulip.)
|
(Messages are automatically posted to the public #feedback channel on Zulip.)
|
||||||
|
|
||||||
Usage: rad <COMMAND>
|
Usage: rad[EXE] <COMMAND>
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
auth Manage identities and profiles
|
auth Manage identities and profiles
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue