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

Merge pull request #2898 from jfinkels/tail-lines-zero-terminated

tail: support zero-terminated lines in streams
This commit is contained in:
Sylvestre Ledru 2022-01-30 09:44:04 +01:00 committed by GitHub
commit b8b642101f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 21 deletions

View file

@ -548,3 +548,17 @@ fn test_no_such_file() {
fn test_no_trailing_newline() {
new_ucmd!().pipe_in("x").succeeds().stdout_only("x");
}
#[test]
fn test_lines_zero_terminated() {
new_ucmd!()
.args(&["-z", "-n", "2"])
.pipe_in("a\0b\0c\0d\0e\0")
.succeeds()
.stdout_only("d\0e\0");
new_ucmd!()
.args(&["-z", "-n", "+2"])
.pipe_in("a\0b\0c\0d\0e\0")
.succeeds()
.stdout_only("b\0c\0d\0e\0");
}