mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tsort: move from getopts to clap (#1867)
This commit is contained in:
parent
f593cf53b2
commit
d86ee34bc6
3 changed files with 52 additions and 33 deletions
|
@ -15,3 +15,36 @@ fn test_sort_self_loop() {
|
|||
.succeeds()
|
||||
.stdout_only("first\nsecond\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_such_file() {
|
||||
let result = new_ucmd!().arg("invalid_file_txt").run();
|
||||
|
||||
assert_eq!(true, result.stderr.contains("No such file or directory"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_version_flag() {
|
||||
let version_short = new_ucmd!().arg("-V").run();
|
||||
let version_long = new_ucmd!().arg("--version").run();
|
||||
|
||||
assert_eq!(version_short.stdout, version_long.stdout);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_help_flag() {
|
||||
let help_short = new_ucmd!().arg("-h").run();
|
||||
let help_long = new_ucmd!().arg("--help").run();
|
||||
|
||||
assert_eq!(help_short.stdout, help_long.stdout);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_arguments() {
|
||||
let result = new_ucmd!()
|
||||
.arg("call_graph.txt")
|
||||
.arg("invalid_file.txt")
|
||||
.run();
|
||||
|
||||
assert_eq!(true, result.stderr.contains("error: Found argument 'invalid_file.txt' which wasn't expected, or isn't valid in this context"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue