diff options
author | Ruediger Meier | 2017-06-13 15:33:58 +0200 |
---|---|---|
committer | Karel Zak | 2017-06-14 11:48:22 +0200 |
commit | 5abaf5b035e00b877ad125cbe7f0770b216459df (patch) | |
tree | 2f15db8bb126d7e0a1a9f0ca2877e7a4901d72fa /tests/ts | |
parent | misc: fix ggc-7 fallthrough warnings (diff) | |
download | kernel-qcow2-util-linux-5abaf5b035e00b877ad125cbe7f0770b216459df.tar.gz kernel-qcow2-util-linux-5abaf5b035e00b877ad125cbe7f0770b216459df.tar.xz kernel-qcow2-util-linux-5abaf5b035e00b877ad125cbe7f0770b216459df.zip |
tests: add more tests for line(1)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts')
-rwxr-xr-x | tests/ts/misc/line | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/ts/misc/line b/tests/ts/misc/line index 71d5c0424..186a78958 100755 --- a/tests/ts/misc/line +++ b/tests/ts/misc/line @@ -19,19 +19,40 @@ TS_DESC="line" ts_init "$*" ts_check_test_command "$TS_CMD_LINE" +ts_check_test_command "$TS_CMD_HEXDUMP" -# usually behave like "head -n 1" +ts_log '# usually behave like "head -n 1"' printf "a\nb\n" | - $TS_CMD_LINE > $TS_OUTPUT 2>&1 + $TS_CMD_LINE >> $TS_OUTPUT 2>&1 echo "ret: $?" >> $TS_OUTPUT -# never consume more than one line +ts_log '# never consume more than one line' printf "1\n2\n" | ($TS_CMD_LINE && $TS_CMD_LINE) >> $TS_OUTPUT 2>&1 echo "ret: $?" >> $TS_OUTPUT -# always print one newline, return 1 on EOF +ts_log '# add a newline' +printf "abc" | + $TS_CMD_LINE >> $TS_OUTPUT 2>&1 +echo "ret: $?" >> $TS_OUTPUT + +ts_log '# print one newline on empty input' +printf "" | + $TS_CMD_LINE >> $TS_OUTPUT 2>&1 +echo "ret: $?" >> $TS_OUTPUT + +ts_log '# add a newline, return 1 when EOF' +(printf "xyz" && cat </dev/null) | + $TS_CMD_LINE >> $TS_OUTPUT 2>&1 +echo "ret: $?" >> $TS_OUTPUT + +ts_log '# print one newline on empty input, return 1 when EOF' $TS_CMD_LINE </dev/null >> $TS_OUTPUT 2>&1 echo "ret: $?" >> $TS_OUTPUT +ts_log '# large line of zero bytes' +dd if=/dev/zero bs=1k count=1k 2>/dev/null | + $TS_CMD_LINE line | $TS_CMD_HEXDUMP -C >> $TS_OUTPUT 2>&1 +echo "ret: $?" >> $TS_OUTPUT + ts_finalize |