-# usually behave like "head -n 1"
-a
-ret: 0
-# never consume more than one line
-1
-2
-ret: 0
-# add a newline
-abc
-ret: 1
-# print one newline on empty input
-
-ret: 1
-# add a newline, return 1 when EOF
-xyz
-ret: 1
-# print one newline on empty input, return 1 when EOF
-
-ret: 1
-# large line of zero bytes
-00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-*
-00100000 0a |.|
-00100001
-ret: 0
ts_check_test_command "$TS_CMD_LINE"
ts_check_test_command "$TS_CMD_HEXDUMP"
-ts_log '# usually behave like "head -n 1"'
+ts_init_subtest 'one-call'
printf "a\nb\n" |
$TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
echo "ret: $?" >> $TS_OUTPUT
+ts_finalize_subtest
-ts_log '# never consume more than one line'
+ts_init_subtest 'two-calls'
printf "1\n2\n" |
($TS_CMD_LINE && $TS_CMD_LINE) >> $TS_OUTPUT 2>> $TS_ERRLOG
echo "ret: $?" >> $TS_OUTPUT
+ts_finalize_subtest
-ts_log '# add a newline'
+ts_init_subtest 'text-without-eol'
printf "abc" |
$TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
echo "ret: $?" >> $TS_OUTPUT
+ts_finalize_subtest
-ts_log '# print one newline on empty input'
+ts_init_subtest 'empty-input'
printf "" |
$TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
echo "ret: $?" >> $TS_OUTPUT
+ts_finalize_subtest
-ts_log '# add a newline, return 1 when EOF'
+ts_init_subtest 'wait-for-eof'
(printf "xyz" && cat </dev/null) |
$TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG
echo "ret: $?" >> $TS_OUTPUT
+ts_finalize_subtest
-ts_log '# print one newline on empty input, return 1 when EOF'
+ts_init_subtest 'empty-input-wait-for-eof'
$TS_CMD_LINE </dev/null >> $TS_OUTPUT 2>> $TS_ERRLOG
echo "ret: $?" >> $TS_OUTPUT
+ts_finalize_subtest
-ts_log '# large line of zero bytes'
+ts_init_subtest 'large-line'
dd if=/dev/zero bs=1k count=1k 2>/dev/null |
$TS_CMD_LINE line | $TS_CMD_HEXDUMP -C >> $TS_OUTPUT 2>> $TS_ERRLOG
echo "ret: $?" >> $TS_OUTPUT
+ts_finalize_subtest
ts_finalize
# This test provides different result on some terminals and virtual machines
TS_KNOWN_FAIL="yes"
-ts_log "printable characters"
+ts_init_subtest "printable-characters"
$TS_CMD_UL < $TS_SELF/basic.input >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
-ts_log "filter input"
+ts_init_subtest "filter-input"
$TS_CMD_UL $TS_SELF/filter.input >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
-ts_log "indicated"
+ts_init_subtest "indicated"
printf "u\b_l\b_\n" | ul --indicated >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
ts_finalize