summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2019-07-23 16:26:48 +0200
committerKarel Zak2019-07-23 16:26:48 +0200
commitfc970a0947469b2a7fe80af704e9fca307116c0f (patch)
treeafa372d528ac71569ad5b77c6024cd172ba64e41
parentlibsmartcols: cleanup and extend padding functionality (diff)
downloadkernel-qcow2-util-linux-fc970a0947469b2a7fe80af704e9fca307116c0f.tar.gz
kernel-qcow2-util-linux-fc970a0947469b2a7fe80af704e9fca307116c0f.tar.xz
kernel-qcow2-util-linux-fc970a0947469b2a7fe80af704e9fca307116c0f.zip
tests: (libsmartcols) add padding tests
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--tests/expected/libsmartcols/fromfile-padding-default11
-rw-r--r--tests/expected/libsmartcols/fromfile-padding-maxout11
-rw-r--r--tests/expected/libsmartcols/fromfile-padding-minout11
-rw-r--r--tests/ts/libsmartcols/files/data-string-empty10
-rwxr-xr-xtests/ts/libsmartcols/fromfile46
5 files changed, 89 insertions, 0 deletions
diff --git a/tests/expected/libsmartcols/fromfile-padding-default b/tests/expected/libsmartcols/fromfile-padding-default
new file mode 100644
index 000000000..f935be267
--- /dev/null
+++ b/tests/expected/libsmartcols/fromfile-padding-default
@@ -0,0 +1,11 @@
+NAME.. ......NUM STRINGS STRINGS
+aaaa.. ........0 aaaa... aaaa
+bbb... ......100 bbb.... bbb
+ccccc. .......21 ccccc.. ccccc
+dddddd ........3 dddddd. dddddd
+ee.... ......411 ee..... ee
+ffff.. .....5111 .......
+gggggg 678993321 gggggg. gggggg
+hhh... ..7666666 hhh.... hhh
+iiiiii .....8765 iiiiii. iiiiii
+jj.... ...987456 jj..... jj
diff --git a/tests/expected/libsmartcols/fromfile-padding-maxout b/tests/expected/libsmartcols/fromfile-padding-maxout
new file mode 100644
index 000000000..3f73ce38b
--- /dev/null
+++ b/tests/expected/libsmartcols/fromfile-padding-maxout
@@ -0,0 +1,11 @@
+NAME.............. ..................NUM STRINGS............ STRINGS............
+aaaa.............. ....................0 aaaa............... aaaa...............
+bbb............... ..................100 bbb................ bbb................
+ccccc............. ...................21 ccccc.............. ccccc..............
+dddddd............ ....................3 dddddd............. dddddd.............
+ee................ ..................411 ee................. ee.................
+ffff.............. .................5111 ................... ...................
+gggggg............ ............678993321 gggggg............. gggggg.............
+hhh............... ..............7666666 hhh................ hhh................
+iiiiii............ .................8765 iiiiii............. iiiiii.............
+jj................ ...............987456 jj................. jj.................
diff --git a/tests/expected/libsmartcols/fromfile-padding-minout b/tests/expected/libsmartcols/fromfile-padding-minout
new file mode 100644
index 000000000..ac8eabc93
--- /dev/null
+++ b/tests/expected/libsmartcols/fromfile-padding-minout
@@ -0,0 +1,11 @@
+NAME.. ......NUM STRINGS STRINGS
+aaaa.. ........0 aaaa... aaaa
+bbb... ......100 bbb.... bbb
+ccccc. .......21 ccccc.. ccccc
+dddddd ........3 dddddd. dddddd
+ee.... ......411 ee..... ee
+ffff.. .....5111
+gggggg 678993321 gggggg. gggggg
+hhh... ..7666666 hhh.... hhh
+iiiiii .....8765 iiiiii. iiiiii
+jj.... ...987456 jj..... jj
diff --git a/tests/ts/libsmartcols/files/data-string-empty b/tests/ts/libsmartcols/files/data-string-empty
new file mode 100644
index 000000000..1f8ad34e5
--- /dev/null
+++ b/tests/ts/libsmartcols/files/data-string-empty
@@ -0,0 +1,10 @@
+aaaa
+bbb
+ccccc
+dddddd
+ee
+
+gggggg
+hhh
+iiiiii
+jj
diff --git a/tests/ts/libsmartcols/fromfile b/tests/ts/libsmartcols/fromfile
index 274081ea0..20994d661 100755
--- a/tests/ts/libsmartcols/fromfile
+++ b/tests/ts/libsmartcols/fromfile
@@ -114,6 +114,52 @@ ts_run $TESTPROG --nlines 10 --maxout --width 80\
>> $TS_OUTPUT 2>&1
ts_finalize_subtest
+ts_init_subtest "padding-default"
+export LIBSMARTCOLS_DEBUG_PADDING=on
+ts_run $TESTPROG --nlines 10 --width 80 \
+ --column $TS_SELF/files/col-name \
+ --column $TS_SELF/files/col-number \
+ --column $TS_SELF/files/col-string \
+ --column $TS_SELF/files/col-string \
+ $TS_SELF/files/data-string \
+ $TS_SELF/files/data-number \
+ $TS_SELF/files/data-string-empty \
+ $TS_SELF/files/data-string-empty \
+ >> $TS_OUTPUT 2> /dev/null
+ts_finalize_subtest
+
+ts_init_subtest "padding-maxout"
+export LIBSMARTCOLS_DEBUG_PADDING=on
+ts_run $TESTPROG --nlines 10 --width 80 \
+ --maxout \
+ --column $TS_SELF/files/col-name \
+ --column $TS_SELF/files/col-number \
+ --column $TS_SELF/files/col-string \
+ --column $TS_SELF/files/col-string \
+ $TS_SELF/files/data-string \
+ $TS_SELF/files/data-number \
+ $TS_SELF/files/data-string-empty \
+ $TS_SELF/files/data-string-empty \
+ >> $TS_OUTPUT 2> /dev/null
+ts_finalize_subtest
+
+ts_init_subtest "padding-minout"
+export LIBSMARTCOLS_DEBUG_PADDING=on
+ts_run $TESTPROG --nlines 10 --width 80 \
+ --minout \
+ --column $TS_SELF/files/col-name \
+ --column $TS_SELF/files/col-number \
+ --column $TS_SELF/files/col-string \
+ --column $TS_SELF/files/col-string \
+ $TS_SELF/files/data-string \
+ $TS_SELF/files/data-number \
+ $TS_SELF/files/data-string-empty \
+ $TS_SELF/files/data-string-empty \
+ >> $TS_OUTPUT 2> /dev/null
+ts_finalize_subtest
+
+unset LIBSMARTCOLS_DEBUG_PADDING
+
ts_init_subtest "strictwidth"
ts_run $TESTPROG --nlines 10 \
--column $TS_SELF/files/col-name \