mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
pr: fix heuristic for number-lines argument (#3109)
This commit is contained in:
parent
75b3cbcfd9
commit
bb379b5384
2 changed files with 15 additions and 1 deletions
|
@ -448,3 +448,16 @@ fn test_with_join_lines_option() {
|
|||
&valid_last_modified_template_vars(start),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_value_for_number_lines() {
|
||||
// *5 is of the form [SEP[NUMBER]] so is accepted and succeeds
|
||||
new_ucmd!().args(&["-n", "*5", "test.log"]).succeeds();
|
||||
|
||||
// a is of the form [SEP[NUMBER]] so is accepted and succeeds
|
||||
new_ucmd!().args(&["-n", "a", "test.log"]).succeeds();
|
||||
|
||||
// foo5.txt is of not the form [SEP[NUMBER]] so is not used as value.
|
||||
// Therefore, pr tries to access the file, which does not exist.
|
||||
new_ucmd!().args(&["-n", "foo5.txt", "test.log"]).fails();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue