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

tail: Implement tail -z.

This options makes tail use NULL instead of newline as a line
delimiter.
This commit is contained in:
Valentin Lorentz 2016-04-02 12:32:33 +02:00
parent 9e5a2400be
commit 2fd7164cda
4 changed files with 25 additions and 10 deletions

BIN
tests/fixtures/tail/foobar_with_null.txt vendored Normal file

Binary file not shown.

Binary file not shown.

View file

@ -8,6 +8,7 @@ use common::util::*;
static UTIL_NAME: &'static str = "tail";
static FOOBAR_TXT: &'static str = "foobar.txt";
static FOOBAR_WITH_NULL_TXT: &'static str = "foobar_with_null.txt";
#[test]
fn test_stdin_default() {
@ -30,6 +31,13 @@ fn test_n_greater_than_number_of_lines() {
assert_eq!(result.stdout, at.read(FOOBAR_TXT));
}
#[test]
fn test_null_default() {
let (at, mut ucmd) = testing(UTIL_NAME);
let result = ucmd.arg("-z").arg(FOOBAR_WITH_NULL_TXT).run();
assert_eq!(result.stdout, at.read("foobar_with_null_default.expected"));
}
#[test]
fn test_single_big_args() {
const FILE: &'static str = "single_big_args.txt";