mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
fix(tail): add support for negative indexing (#1865)
closes: https://github.com/uutils/coreutils/issues/1860
This commit is contained in:
parent
21be280c5a
commit
27b7552ef4
2 changed files with 18 additions and 2 deletions
|
@ -329,3 +329,17 @@ fn test_multiple_input_quiet_flag_overrides_verbose_flag_for_suppressing_headers
|
|||
.run()
|
||||
.stdout_is_fixture("foobar_multiple_quiet.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_negative_indexing() {
|
||||
let positive_lines_index = new_ucmd!().arg("-n").arg("5").arg(FOOBAR_TXT).run();
|
||||
|
||||
let negative_lines_index = new_ucmd!().arg("-n").arg("-5").arg(FOOBAR_TXT).run();
|
||||
|
||||
let positive_bytes_index = new_ucmd!().arg("-c").arg("20").arg(FOOBAR_TXT).run();
|
||||
|
||||
let negative_bytes_index = new_ucmd!().arg("-c").arg("-20").arg(FOOBAR_TXT).run();
|
||||
|
||||
assert_eq!(positive_lines_index.stdout, negative_lines_index.stdout);
|
||||
assert_eq!(positive_bytes_index.stdout, negative_bytes_index.stdout);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue