]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: split additional tests into subtests
authorVojtěch Eichler <vojta.eich@gmail.com>
Tue, 19 Oct 2021 18:45:28 +0000 (20:45 +0200)
committerVojtěch Eichler <vojta.eich@gmail.com>
Tue, 19 Oct 2021 18:45:28 +0000 (20:45 +0200)
14 files changed:
tests/expected/misc/line
tests/expected/misc/line-empty-input [new file with mode: 0644]
tests/expected/misc/line-empty-input-wait-for-eof [new file with mode: 0644]
tests/expected/misc/line-large-line [new file with mode: 0644]
tests/expected/misc/line-one-call [new file with mode: 0644]
tests/expected/misc/line-text-without-eol [new file with mode: 0644]
tests/expected/misc/line-two-calls [new file with mode: 0644]
tests/expected/misc/line-wait-for-eof [new file with mode: 0644]
tests/expected/ul/basic
tests/expected/ul/basic-filter-input [new file with mode: 0644]
tests/expected/ul/basic-indicated [new file with mode: 0644]
tests/expected/ul/basic-printable-characters [new file with mode: 0644]
tests/ts/misc/line
tests/ts/ul/basic

index 783ef801f5f2bec66f221bb790057a87cc805531..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,25 +0,0 @@
-# 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
diff --git a/tests/expected/misc/line-empty-input b/tests/expected/misc/line-empty-input
new file mode 100644 (file)
index 0000000..29c61d5
--- /dev/null
@@ -0,0 +1,2 @@
+
+ret: 1
diff --git a/tests/expected/misc/line-empty-input-wait-for-eof b/tests/expected/misc/line-empty-input-wait-for-eof
new file mode 100644 (file)
index 0000000..29c61d5
--- /dev/null
@@ -0,0 +1,2 @@
+
+ret: 1
diff --git a/tests/expected/misc/line-large-line b/tests/expected/misc/line-large-line
new file mode 100644 (file)
index 0000000..dc4f520
--- /dev/null
@@ -0,0 +1,5 @@
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00100000  0a                                                |.|
+00100001
+ret: 0
diff --git a/tests/expected/misc/line-one-call b/tests/expected/misc/line-one-call
new file mode 100644 (file)
index 0000000..cbf0b3b
--- /dev/null
@@ -0,0 +1,2 @@
+a
+ret: 0
diff --git a/tests/expected/misc/line-text-without-eol b/tests/expected/misc/line-text-without-eol
new file mode 100644 (file)
index 0000000..42f49d6
--- /dev/null
@@ -0,0 +1,2 @@
+abc
+ret: 1
diff --git a/tests/expected/misc/line-two-calls b/tests/expected/misc/line-two-calls
new file mode 100644 (file)
index 0000000..dfe723f
--- /dev/null
@@ -0,0 +1,3 @@
+1
+2
+ret: 0
diff --git a/tests/expected/misc/line-wait-for-eof b/tests/expected/misc/line-wait-for-eof
new file mode 100644 (file)
index 0000000..fcc3c8f
--- /dev/null
@@ -0,0 +1,2 @@
+xyz
+ret: 1
index 8838f147240ec14c30c3649578ebb1217e39c482..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,111 +0,0 @@
-printable characters
-!
-"
-#
-$
-%
-&
-'
-(
-)
-*
-+
-,
--
-.
-/
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9
-:
-;
-<
-=
->
-?
-@
-A
-B
-C
-D
-E
-F
-G
-H
-I
-J
-K
-L
-M
-N
-O
-P
-Q
-R
-S
-T
-U
-V
-W
-X
-Y
-Z
-[
-\
-]
-^
-_
-`
-a
-b
-c
-d
-e
-f
-g
-h
-i
-j
-k
-l
-m
-n
-o
-p
-q
-r
-s
-t
-u
-v
-w
-x
-y
-z
-{
-|
-}
-~
-filter input
-backspacex
-        tab
-R
-SO
-\e[7mSI\e(B\e[m
-\e[4munder\e[24mline
-flush
-\fafter flush
-normal
-\e[A\e[A\e[C\e[C\e[C\e[C\e[C\e[Creverse
-eof
-indicated
-ul
-__
diff --git a/tests/expected/ul/basic-filter-input b/tests/expected/ul/basic-filter-input
new file mode 100644 (file)
index 0000000..b8154c1
--- /dev/null
@@ -0,0 +1,11 @@
+backspacex
+        tab
+R
+SO
+\e[7mSI\e(B\e[m
+\e[4munder\e[24mline
+flush
+\fafter flush
+normal
+\e[A\e[A\e[C\e[C\e[C\e[C\e[C\e[Creverse
+eof
diff --git a/tests/expected/ul/basic-indicated b/tests/expected/ul/basic-indicated
new file mode 100644 (file)
index 0000000..5b57285
--- /dev/null
@@ -0,0 +1,2 @@
+ul
+__
diff --git a/tests/expected/ul/basic-printable-characters b/tests/expected/ul/basic-printable-characters
new file mode 100644 (file)
index 0000000..3bc7fbc
--- /dev/null
@@ -0,0 +1,95 @@
+!
+"
+#
+$
+%
+&
+'
+(
+)
+*
++
+,
+-
+.
+/
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+:
+;
+<
+=
+>
+?
+@
+A
+B
+C
+D
+E
+F
+G
+H
+I
+J
+K
+L
+M
+N
+O
+P
+Q
+R
+S
+T
+U
+V
+W
+X
+Y
+Z
+[
+\
+]
+^
+_
+`
+a
+b
+c
+d
+e
+f
+g
+h
+i
+j
+k
+l
+m
+n
+o
+p
+q
+r
+s
+t
+u
+v
+w
+x
+y
+z
+{
+|
+}
+~
index 62fcb7964d122ec88c9bf5f9b78cbd57778be0a8..8424fc7f0b60d7dc587cc27335f6377454ef3ed7 100755 (executable)
@@ -21,38 +21,45 @@ ts_init "$*"
 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
index 5a7ff0368737fd40c9bf9a64f3a502884fc1c887..883c8dea086f6847da95e2e541bf02cd55d9c508 100755 (executable)
@@ -27,13 +27,16 @@ ts_check_test_command "$TS_CMD_UL"
 # 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