1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

[: add support for --help and --version

I copied the help text verbatim from GNU, I hope that's ok.
This commit is contained in:
Michael Debertol 2021-06-29 20:49:02 +02:00
parent cd83aed89c
commit bc0727cc4d
2 changed files with 104 additions and 2 deletions

View file

@ -718,3 +718,21 @@ fn test_bracket_syntax_missing_right_bracket() {
.status_code(2)
.stderr_is("[: missing ']'");
}
#[test]
fn test_bracket_syntax_help() {
let scenario = TestScenario::new("[");
let mut ucmd = scenario.ucmd();
ucmd.arg("--help").succeeds().stdout_contains("USAGE:");
}
#[test]
fn test_bracket_syntax_version() {
let scenario = TestScenario::new("[");
let mut ucmd = scenario.ucmd();
ucmd.arg("--version")
.succeeds()
.stdout_matches(&r"\[ \d+\.\d+\.\d+".parse().unwrap());
}