]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (column) add range and negative numbers column addresses
authorKarel Zak <kzak@redhat.com>
Wed, 4 Jan 2023 13:08:46 +0000 (14:08 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 4 Jan 2023 13:08:46 +0000 (14:08 +0100)
Addresses: https://github.com/util-linux/util-linux/issues/1700
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/column/table-neg-1 [new file with mode: 0644]
tests/expected/column/table-neg-1-2 [new file with mode: 0644]
tests/expected/column/table-neg-2 [new file with mode: 0644]
tests/expected/column/table-range [new file with mode: 0644]
tests/ts/column/table

diff --git a/tests/expected/column/table-neg-1 b/tests/expected/column/table-neg-1
new file mode 100644 (file)
index 0000000..994c533
--- /dev/null
@@ -0,0 +1 @@
+A                  |B                  |C                  |                   D
diff --git a/tests/expected/column/table-neg-1-2 b/tests/expected/column/table-neg-1-2
new file mode 100644 (file)
index 0000000..b2ed204
--- /dev/null
@@ -0,0 +1 @@
+A                  |B                  |                  C|                   D
diff --git a/tests/expected/column/table-neg-2 b/tests/expected/column/table-neg-2
new file mode 100644 (file)
index 0000000..43cf96c
--- /dev/null
@@ -0,0 +1 @@
+A                  |B                  |                  C|D                   
diff --git a/tests/expected/column/table-range b/tests/expected/column/table-range
new file mode 100644 (file)
index 0000000..e0f7d4c
--- /dev/null
@@ -0,0 +1 @@
+A                  |                  B|                  C|D                   
index ca01b060a19153ee4132cbbb5c0a2777345231cc..8b22d838e65f919091d8129806704999d6231662 100755 (executable)
@@ -125,4 +125,24 @@ ts_init_subtest "empty-column-at-eol2"
 printf '||' | $TS_CMD_COLUMN --separator '|' --output-separator '|' --table >> $TS_OUTPUT 2>> $TS_ERRLOG
 ts_finalize_subtest
 
+ts_init_subtest "neg-1"
+echo "A B C D" | $TS_CMD_COLUMN --output-separator '|' --table --table-maxout \
+       --table-right -1 --output-width=80 >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
+
+ts_init_subtest "neg-2"
+echo "A B C D" | $TS_CMD_COLUMN --output-separator '|' --table --table-maxout \
+       --table-right -2 --output-width=80 >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
+
+ts_init_subtest "neg-1-2"
+echo "A B C D" | $TS_CMD_COLUMN --output-separator '|' --table --table-maxout \
+       --table-right -1,-2 --output-width=80 >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
+
+ts_init_subtest "range"
+echo "A B C D" | $TS_CMD_COLUMN --output-separator '|' --table --table-maxout \
+       --table-right 2-3 --output-width=80 >> $TS_OUTPUT 2>> $TS_ERRLOG
+ts_finalize_subtest
+
 ts_finalize