From 83f79678dbb9cb48969968fa4df57d98c67a321d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 31 May 2018 11:44:35 +0200 Subject: [PATCH 154/173] tests: backport libsmartcols tests Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1561350 Signed-off-by: Karel Zak --- tests/commands.sh | 2 + tests/expected/libsmartcols/fromfile | 1 + .../libsmartcols/fromfile-column-separator | 11 + tests/expected/libsmartcols/fromfile-export | 10 + tests/expected/libsmartcols/fromfile-hidden | 11 + tests/expected/libsmartcols/fromfile-noextremes | 12 ++ tests/expected/libsmartcols/fromfile-raw | 11 + tests/expected/libsmartcols/fromfile-right | 11 + tests/expected/libsmartcols/fromfile-right-maxout | 11 + tests/expected/libsmartcols/fromfile-strictwidth | 11 + tests/expected/libsmartcols/fromfile-tree | 11 + tests/expected/libsmartcols/fromfile-tree-end | 11 + tests/expected/libsmartcols/fromfile-tree-json | 29 +++ tests/expected/libsmartcols/fromfile-tree-middle | 11 + tests/expected/libsmartcols/fromfile-trunc | 11 + tests/expected/libsmartcols/fromfile-wrap | 17 ++ tests/expected/libsmartcols/fromfile-wrap-tree | 18 ++ tests/expected/libsmartcols/fromfile-wrapnl | 19 ++ tests/expected/libsmartcols/fromfile-wrapnl-tree | 19 ++ tests/expected/libsmartcols/title | 16 ++ tests/ts/libsmartcols/files/col-hidden | 3 + tests/ts/libsmartcols/files/col-id | 3 + tests/ts/libsmartcols/files/col-name | 3 + tests/ts/libsmartcols/files/col-noextremes | 3 + tests/ts/libsmartcols/files/col-number | 3 + tests/ts/libsmartcols/files/col-parent | 3 + tests/ts/libsmartcols/files/col-strict | 3 + tests/ts/libsmartcols/files/col-string | 3 + tests/ts/libsmartcols/files/col-tree | 3 + tests/ts/libsmartcols/files/col-trunc | 3 + tests/ts/libsmartcols/files/col-wrap | 3 + tests/ts/libsmartcols/files/col-wrapnl | 3 + tests/ts/libsmartcols/files/data-id | 10 + tests/ts/libsmartcols/files/data-number | 10 + tests/ts/libsmartcols/files/data-number-tiny | 10 + tests/ts/libsmartcols/files/data-parent | 10 + tests/ts/libsmartcols/files/data-string | 10 + tests/ts/libsmartcols/files/data-string-extreme | 10 + tests/ts/libsmartcols/files/data-string-long | 10 + tests/ts/libsmartcols/files/data-string-nl | 10 + tests/ts/libsmartcols/fromfile | 240 +++++++++++++++++++++ tests/ts/libsmartcols/title | 28 +++ 42 files changed, 637 insertions(+) create mode 100644 tests/expected/libsmartcols/fromfile create mode 100644 tests/expected/libsmartcols/fromfile-column-separator create mode 100644 tests/expected/libsmartcols/fromfile-export create mode 100644 tests/expected/libsmartcols/fromfile-hidden create mode 100644 tests/expected/libsmartcols/fromfile-noextremes create mode 100644 tests/expected/libsmartcols/fromfile-raw create mode 100644 tests/expected/libsmartcols/fromfile-right create mode 100644 tests/expected/libsmartcols/fromfile-right-maxout create mode 100644 tests/expected/libsmartcols/fromfile-strictwidth create mode 100644 tests/expected/libsmartcols/fromfile-tree create mode 100644 tests/expected/libsmartcols/fromfile-tree-end create mode 100644 tests/expected/libsmartcols/fromfile-tree-json create mode 100644 tests/expected/libsmartcols/fromfile-tree-middle create mode 100644 tests/expected/libsmartcols/fromfile-trunc create mode 100644 tests/expected/libsmartcols/fromfile-wrap create mode 100644 tests/expected/libsmartcols/fromfile-wrap-tree create mode 100644 tests/expected/libsmartcols/fromfile-wrapnl create mode 100644 tests/expected/libsmartcols/fromfile-wrapnl-tree create mode 100644 tests/expected/libsmartcols/title create mode 100644 tests/ts/libsmartcols/files/col-hidden create mode 100644 tests/ts/libsmartcols/files/col-id create mode 100644 tests/ts/libsmartcols/files/col-name create mode 100644 tests/ts/libsmartcols/files/col-noextremes create mode 100644 tests/ts/libsmartcols/files/col-number create mode 100644 tests/ts/libsmartcols/files/col-parent create mode 100644 tests/ts/libsmartcols/files/col-strict create mode 100644 tests/ts/libsmartcols/files/col-string create mode 100644 tests/ts/libsmartcols/files/col-tree create mode 100644 tests/ts/libsmartcols/files/col-trunc create mode 100644 tests/ts/libsmartcols/files/col-wrap create mode 100644 tests/ts/libsmartcols/files/col-wrapnl create mode 100644 tests/ts/libsmartcols/files/data-id create mode 100644 tests/ts/libsmartcols/files/data-number create mode 100644 tests/ts/libsmartcols/files/data-number-tiny create mode 100644 tests/ts/libsmartcols/files/data-parent create mode 100644 tests/ts/libsmartcols/files/data-string create mode 100644 tests/ts/libsmartcols/files/data-string-extreme create mode 100644 tests/ts/libsmartcols/files/data-string-long create mode 100644 tests/ts/libsmartcols/files/data-string-nl create mode 100755 tests/ts/libsmartcols/fromfile create mode 100755 tests/ts/libsmartcols/title diff --git a/tests/commands.sh b/tests/commands.sh index e769b5dac..96b8dc97c 100644 --- a/tests/commands.sh +++ b/tests/commands.sh @@ -20,6 +20,8 @@ TS_HELPER_PARTITIONS="$top_builddir/sample-partitions" TS_HELPER_PATHS="$top_builddir/test_pathnames" TS_HELPER_STRUTILS="$top_builddir/test_strutils" TS_HELPER_SYSINFO="$top_builddir/test_sysinfo" +TS_HELPER_LIBSMARTCOLS_FROMFILE="$top_builddir/sample-scols-fromfile" +TS_HELPER_LIBSMARTCOLS_TITLE="$top_builddir/sample-scols-title" # paths to commands TS_CMD_BLKID=${TS_CMD_BLKID-"$top_builddir/blkid"} diff --git a/tests/expected/libsmartcols/fromfile b/tests/expected/libsmartcols/fromfile new file mode 100644 index 000000000..4155aa36f --- /dev/null +++ b/tests/expected/libsmartcols/fromfile @@ -0,0 +1 @@ +...done. diff --git a/tests/expected/libsmartcols/fromfile-column-separator b/tests/expected/libsmartcols/fromfile-column-separator new file mode 100644 index 000000000..8c5aa2aff --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-column-separator @@ -0,0 +1,11 @@ +NAME | NUM|TRUNC +aaaa | 0|qqqqqqqqqqqqqqqqqX +bbb | 100|dddddddddddddX +ccccc | 21|ffffffffffffffffffffffffffffffffffffffffX +dddddd| 3|ssssssssssX +ee | 411|ddddddddddddddddddddddddddX +ffff | 5111|jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX +gggggg|678993321|mmmmmmmmmmmmmmmmmmmX +hhh | 7666666|lllllllllllllllllllllllllllllllllllllX +iiiiii| 8765|yyyyyyyyyyyyyyyyyyyyyyyyyyyyX +jj | 987456|pppppppppX diff --git a/tests/expected/libsmartcols/fromfile-export b/tests/expected/libsmartcols/fromfile-export new file mode 100644 index 000000000..f63afd882 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-export @@ -0,0 +1,10 @@ +NAME="aaaa" NUM="0" TRUNC="qqqqqqqqqqqqqqqqqX" +NAME="bbb" NUM="100" TRUNC="dddddddddddddX" +NAME="ccccc" NUM="21" TRUNC="ffffffffffffffffffffffffffffffffffffffffX" +NAME="dddddd" NUM="3" TRUNC="ssssssssssX" +NAME="ee" NUM="411" TRUNC="ddddddddddddddddddddddddddX" +NAME="ffff" NUM="5111" TRUNC="jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX" +NAME="gggggg" NUM="678993321" TRUNC="mmmmmmmmmmmmmmmmmmmX" +NAME="hhh" NUM="7666666" TRUNC="lllllllllllllllllllllllllllllllllllllX" +NAME="iiiiii" NUM="8765" TRUNC="yyyyyyyyyyyyyyyyyyyyyyyyyyyyX" +NAME="jj" NUM="987456" TRUNC="pppppppppX" diff --git a/tests/expected/libsmartcols/fromfile-hidden b/tests/expected/libsmartcols/fromfile-hidden new file mode 100644 index 000000000..cf50bcb3e --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-hidden @@ -0,0 +1,11 @@ +NAME NUM +aaaa 0 +bbb 100 +ccccc 21 +dddddd 3 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/fromfile-noextremes b/tests/expected/libsmartcols/fromfile-noextremes new file mode 100644 index 000000000..4bac08070 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-noextremes @@ -0,0 +1,12 @@ +NAME NOEXTREME NUM NAME NUM +aaaa qqqqqqX 0 aaaa 0 +bbb ddddddddX 100 bbb 100 +ccccc ffffffffffffffffffffffffffffffffffX + 21 ccccc 21 +dddddd sssX 3 dddddd 3 +ee ddX 411 ee 411 +ffff jjjjjX 5111 ffff 5111 +gggggg mmmmmmmX 678993321 gggggg 678993321 +hhh llllllllllX 7666666 hhh 7666666 +iiiiii yyyyyyX 8765 iiiiii 8765 +jj pppppX 987456 jj 987456 diff --git a/tests/expected/libsmartcols/fromfile-raw b/tests/expected/libsmartcols/fromfile-raw new file mode 100644 index 000000000..cc188aaab --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-raw @@ -0,0 +1,11 @@ +NAME NUM TRUNC +aaaa 0 qqqqqqqqqqqqqqqqqX +bbb 100 dddddddddddddX +ccccc 21 ffffffffffffffffffffffffffffffffffffffffX +dddddd 3 ssssssssssX +ee 411 ddddddddddddddddddddddddddX +ffff 5111 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX +gggggg 678993321 mmmmmmmmmmmmmmmmmmmX +hhh 7666666 lllllllllllllllllllllllllllllllllllllX +iiiiii 8765 yyyyyyyyyyyyyyyyyyyyyyyyyyyyX +jj 987456 pppppppppX diff --git a/tests/expected/libsmartcols/fromfile-right b/tests/expected/libsmartcols/fromfile-right new file mode 100644 index 000000000..d78285a13 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-right @@ -0,0 +1,11 @@ +NAME NUM STRINGS +aaaa 0 qqqqqqqqqqqqqqqqqX +bbb 100 dddddddddddddX +ccccc 21 ffffffffffffffffffffffffffffffffffffffffX +dddddd 3 ssssssssssX +ee 411 ddddddddddddddddddddddddddX +ffff 5111 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX +gggggg 678993321 mmmmmmmmmmmmmmmmmmmX +hhh 7666666 lllllllllllllllllllllllllllllllllllllX +iiiiii 8765 yyyyyyyyyyyyyyyyyyyyyyyyyyyyX +jj 987456 pppppppppX diff --git a/tests/expected/libsmartcols/fromfile-right-maxout b/tests/expected/libsmartcols/fromfile-right-maxout new file mode 100644 index 000000000..3bcb65abd --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-right-maxout @@ -0,0 +1,11 @@ +NAME NUM +aaaa 0 +bbb 100 +ccccc 21 +dddddd 3 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/fromfile-strictwidth b/tests/expected/libsmartcols/fromfile-strictwidth new file mode 100644 index 000000000..41054b235 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-strictwidth @@ -0,0 +1,11 @@ +NAME STRICT NUM +aaaa 0 0 +bbb 1 100 +ccccc 2 21 +dddddd 3 3 +ee 4 411 +ffff 5 5111 +gggggg 6 678993321 +hhh 7 7666666 +iiiiii 8 8765 +jj 9 987456 diff --git a/tests/expected/libsmartcols/fromfile-tree b/tests/expected/libsmartcols/fromfile-tree new file mode 100644 index 000000000..9d345f8dc --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-tree @@ -0,0 +1,11 @@ +TREE ID PARENT STRINGS +aaaa 1 0 qqqqqqqqqqqqqqqqqX +|-bbb 2 1 dddddddddddddX +| |-ee 5 2 ddddddddddddddddddddddddddX +| `-ffff 6 2 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX +|-ccccc 3 1 ffffffffffffffffffffffffffffffffffffffffX +| `-gggggg 7 3 mmmmmmmmmmmmmmmmmmmX +| |-hhh 8 7 lllllllllllllllllllllllllllllllllllllX +| | `-iiiiii 9 8 yyyyyyyyyyyyyyyyyyyyyyyyyyyyX +| `-jj 10 7 pppppppppX +`-dddddd 4 1 ssssssssssX diff --git a/tests/expected/libsmartcols/fromfile-tree-end b/tests/expected/libsmartcols/fromfile-tree-end new file mode 100644 index 000000000..41aebff56 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-tree-end @@ -0,0 +1,11 @@ +ID PARENT STRINGS TREE + 1 0 qqqqqqqqqqqqqqqqqX aaaa + 2 1 dddddddddddddX |-bbb + 5 2 ddddddddddddddddddddddddddX | |-ee + 6 2 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX | `-ffff + 3 1 ffffffffffffffffffffffffffffffffffffffffX |-ccccc + 7 3 mmmmmmmmmmmmmmmmmmmX | `-gggggg + 8 7 lllllllllllllllllllllllllllllllllllllX | |-hhh + 9 8 yyyyyyyyyyyyyyyyyyyyyyyyyyyyX | | `-iiiiii +10 7 pppppppppX | `-jj + 4 1 ssssssssssX `-dddddd diff --git a/tests/expected/libsmartcols/fromfile-tree-json b/tests/expected/libsmartcols/fromfile-tree-json new file mode 100644 index 000000000..5b3546d0a --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-tree-json @@ -0,0 +1,29 @@ +{ + "testtable": [ + {"tree":"aaaa", "id":"1", "parent":"0", "strings":"qqqqqqqqqqqqqqqqqX", + "children": [ + {"tree":"bbb", "id":"2", "parent":"1", "strings":"dddddddddddddX", + "children": [ + {"tree":"ee", "id":"5", "parent":"2", "strings":"ddddddddddddddddddddddddddX"}, + {"tree":"ffff", "id":"6", "parent":"2", "strings":"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX"} + ] + }, + {"tree":"ccccc", "id":"3", "parent":"1", "strings":"ffffffffffffffffffffffffffffffffffffffffX", + "children": [ + {"tree":"gggggg", "id":"7", "parent":"3", "strings":"mmmmmmmmmmmmmmmmmmmX", + "children": [ + {"tree":"hhh", "id":"8", "parent":"7", "strings":"lllllllllllllllllllllllllllllllllllllX", + "children": [ + {"tree":"iiiiii", "id":"9", "parent":"8", "strings":"yyyyyyyyyyyyyyyyyyyyyyyyyyyyX"} + ] + }, + {"tree":"jj", "id":"10", "parent":"7", "strings":"pppppppppX"} + ] + } + ] + }, + {"tree":"dddddd", "id":"4", "parent":"1", "strings":"ssssssssssX"} + ] + } + ] +} diff --git a/tests/expected/libsmartcols/fromfile-tree-middle b/tests/expected/libsmartcols/fromfile-tree-middle new file mode 100644 index 000000000..b2183313c --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-tree-middle @@ -0,0 +1,11 @@ +ID PARENT TREE STRINGS + 1 0 aaaa qqqqqqqqqqqqqqqqqX + 2 1 |-bbb dddddddddddddX + 5 2 | |-ee ddddddddddddddddddddddddddX + 6 2 | `-ffff jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX + 3 1 |-ccccc ffffffffffffffffffffffffffffffffffffffffX + 7 3 | `-gggggg mmmmmmmmmmmmmmmmmmmX + 8 7 | |-hhh lllllllllllllllllllllllllllllllllllllX + 9 8 | | `-iiiiii yyyyyyyyyyyyyyyyyyyyyyyyyyyyX +10 7 | `-jj pppppppppX + 4 1 `-dddddd ssssssssssX diff --git a/tests/expected/libsmartcols/fromfile-trunc b/tests/expected/libsmartcols/fromfile-trunc new file mode 100644 index 000000000..6a095dc88 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-trunc @@ -0,0 +1,11 @@ +NAME NUM TRUNC +aaaa 0 qqqqqqqqqqqqqqqqqX +bbb 100 dddddddddddddX +ccccc 21 fffffffffffffffffffffff +dddddd 3 ssssssssssX +ee 411 ddddddddddddddddddddddd +ffff 5111 jjjjjjjjjjjjjjjjjjjjjjj +gggggg 678993321 mmmmmmmmmmmmmmmmmmmX +hhh 7666666 lllllllllllllllllllllll +iiiiii 8765 yyyyyyyyyyyyyyyyyyyyyyy +jj 987456 pppppppppX diff --git a/tests/expected/libsmartcols/fromfile-wrap b/tests/expected/libsmartcols/fromfile-wrap new file mode 100644 index 000000000..bb94f4973 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-wrap @@ -0,0 +1,17 @@ +NAME NUM WRAP +aaaa 0 qqqqqqqqqqqqqqqqqX +bbb 100 dddddddddddddX +ccccc 21 fffffffffffffffffffffff + fffffffffffffffffX +dddddd 3 ssssssssssX +ee 411 ddddddddddddddddddddddd + dddX +ffff 5111 jjjjjjjjjjjjjjjjjjjjjjj + jjjjjjjjjjjjjjjjjjjjjjj + jjjX +gggggg 678993321 mmmmmmmmmmmmmmmmmmmX +hhh 7666666 lllllllllllllllllllllll + llllllllllllllX +iiiiii 8765 yyyyyyyyyyyyyyyyyyyyyyy + yyyyyX +jj 987456 pppppppppX diff --git a/tests/expected/libsmartcols/fromfile-wrap-tree b/tests/expected/libsmartcols/fromfile-wrap-tree new file mode 100644 index 000000000..a2db7a4ac --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-wrap-tree @@ -0,0 +1,18 @@ +TREE ID PARENT WRAP +aaaa 1 0 qqqqqqqqqqqqqqqqqX +|-bbb 2 1 dddddddddddddX +| |-ee 5 2 dddddddddddddddddddd +| | ddddddX +| `-ffff 6 2 jjjjjjjjjjjjjjjjjjjj +| jjjjjjjjjjjjjjjjjjjj +| jjjjjjjjjX +|-ccccc 3 1 ffffffffffffffffffff +| | ffffffffffffffffffff +| | X +| `-gggggg 7 3 mmmmmmmmmmmmmmmmmmmX +| |-hhh 8 7 llllllllllllllllllll +| | | lllllllllllllllllX +| | `-iiiiii 9 8 yyyyyyyyyyyyyyyyyyyy +| | yyyyyyyyX +| `-jj 10 7 pppppppppX +`-dddddd 4 1 ssssssssssX diff --git a/tests/expected/libsmartcols/fromfile-wrapnl b/tests/expected/libsmartcols/fromfile-wrapnl new file mode 100644 index 000000000..c747ebb08 --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-wrapnl @@ -0,0 +1,19 @@ +NAME NUM WRAPNL +aaaa 0 aaa +bbb 100 bbbbb +ccccc 21 cccc + CCCC +dddddd 3 dddddddd + DDDD + DD +ee 411 hello + baby +ffff 5111 aaa + bbb + ccc + ddd +gggggg 678993321 eee +hhh 7666666 fffff +iiiiii 8765 g + hhhhh +jj 987456 ppppppppp diff --git a/tests/expected/libsmartcols/fromfile-wrapnl-tree b/tests/expected/libsmartcols/fromfile-wrapnl-tree new file mode 100644 index 000000000..3862cf16a --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-wrapnl-tree @@ -0,0 +1,19 @@ +TREE ID PARENT WRAPNL +aaaa 1 0 aaa +|-bbb 2 1 bbbbb +| |-ee 5 2 hello +| | baby +| `-ffff 6 2 aaa +| bbb +| ccc +| ddd +|-ccccc 3 1 cccc +| | CCCC +| `-gggggg 7 3 eee +| |-hhh 8 7 fffff +| | `-iiiiii 9 8 g +| | hhhhh +| `-jj 10 7 ppppppppp +`-dddddd 4 1 dddddddd + DDDD + DD diff --git a/tests/expected/libsmartcols/title b/tests/expected/libsmartcols/title new file mode 100644 index 000000000..bb5d7225a --- /dev/null +++ b/tests/expected/libsmartcols/title @@ -0,0 +1,16 @@ + This is right title +NAME DATA +foo bla bla bla +bar alb alb alb +This is left title (without padding) +NAME DATA +foo bla bla bla +bar alb alb alb +=======================This is center title (with padding)====================== +NAME DATA +foo bla bla bla +bar alb alb alb +This is left title (with padding)----------------------------------------------- +NAME DATA +foo bla bla bla +bar alb alb alb diff --git a/tests/ts/libsmartcols/files/col-hidden b/tests/ts/libsmartcols/files/col-hidden new file mode 100644 index 000000000..83182a8ee --- /dev/null +++ b/tests/ts/libsmartcols/files/col-hidden @@ -0,0 +1,3 @@ +FOO +0 +hidden diff --git a/tests/ts/libsmartcols/files/col-id b/tests/ts/libsmartcols/files/col-id new file mode 100644 index 000000000..0188f42a0 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-id @@ -0,0 +1,3 @@ +ID +0 +right diff --git a/tests/ts/libsmartcols/files/col-name b/tests/ts/libsmartcols/files/col-name new file mode 100644 index 000000000..0a98f29cf --- /dev/null +++ b/tests/ts/libsmartcols/files/col-name @@ -0,0 +1,3 @@ +NAME +0 +none diff --git a/tests/ts/libsmartcols/files/col-noextremes b/tests/ts/libsmartcols/files/col-noextremes new file mode 100644 index 000000000..715edce7e --- /dev/null +++ b/tests/ts/libsmartcols/files/col-noextremes @@ -0,0 +1,3 @@ +NOEXTREME +0 +noextremes diff --git a/tests/ts/libsmartcols/files/col-number b/tests/ts/libsmartcols/files/col-number new file mode 100644 index 000000000..34a70e4a4 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-number @@ -0,0 +1,3 @@ +NUM +0 +right diff --git a/tests/ts/libsmartcols/files/col-parent b/tests/ts/libsmartcols/files/col-parent new file mode 100644 index 000000000..86fe08ced --- /dev/null +++ b/tests/ts/libsmartcols/files/col-parent @@ -0,0 +1,3 @@ +PARENT +0 +right diff --git a/tests/ts/libsmartcols/files/col-strict b/tests/ts/libsmartcols/files/col-strict new file mode 100644 index 000000000..62bb96b9a --- /dev/null +++ b/tests/ts/libsmartcols/files/col-strict @@ -0,0 +1,3 @@ +STRICT +20 +strictwidth,right diff --git a/tests/ts/libsmartcols/files/col-string b/tests/ts/libsmartcols/files/col-string new file mode 100644 index 000000000..7e2904b9f --- /dev/null +++ b/tests/ts/libsmartcols/files/col-string @@ -0,0 +1,3 @@ +STRINGS +0 +none diff --git a/tests/ts/libsmartcols/files/col-tree b/tests/ts/libsmartcols/files/col-tree new file mode 100644 index 000000000..507688000 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-tree @@ -0,0 +1,3 @@ +TREE +0 +tree diff --git a/tests/ts/libsmartcols/files/col-trunc b/tests/ts/libsmartcols/files/col-trunc new file mode 100644 index 000000000..2887b4314 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-trunc @@ -0,0 +1,3 @@ +TRUNC +0 +trunc diff --git a/tests/ts/libsmartcols/files/col-wrap b/tests/ts/libsmartcols/files/col-wrap new file mode 100644 index 000000000..dc4ca340e --- /dev/null +++ b/tests/ts/libsmartcols/files/col-wrap @@ -0,0 +1,3 @@ +WRAP +0 +wrap diff --git a/tests/ts/libsmartcols/files/col-wrapnl b/tests/ts/libsmartcols/files/col-wrapnl new file mode 100644 index 000000000..0a18fd146 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-wrapnl @@ -0,0 +1,3 @@ +WRAPNL +0 +wrapnl diff --git a/tests/ts/libsmartcols/files/data-id b/tests/ts/libsmartcols/files/data-id new file mode 100644 index 000000000..f00c965d8 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-id @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/tests/ts/libsmartcols/files/data-number b/tests/ts/libsmartcols/files/data-number new file mode 100644 index 000000000..562d75061 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-number @@ -0,0 +1,10 @@ +0 +100 +21 +3 +411 +5111 +678993321 +7666666 +8765 +987456 diff --git a/tests/ts/libsmartcols/files/data-number-tiny b/tests/ts/libsmartcols/files/data-number-tiny new file mode 100644 index 000000000..8b1acc12b --- /dev/null +++ b/tests/ts/libsmartcols/files/data-number-tiny @@ -0,0 +1,10 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/tests/ts/libsmartcols/files/data-parent b/tests/ts/libsmartcols/files/data-parent new file mode 100644 index 000000000..aa5071608 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-parent @@ -0,0 +1,10 @@ +0 +1 +1 +1 +2 +2 +3 +7 +8 +7 diff --git a/tests/ts/libsmartcols/files/data-string b/tests/ts/libsmartcols/files/data-string new file mode 100644 index 000000000..dff6e9c80 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-string @@ -0,0 +1,10 @@ +aaaa +bbb +ccccc +dddddd +ee +ffff +gggggg +hhh +iiiiii +jj diff --git a/tests/ts/libsmartcols/files/data-string-extreme b/tests/ts/libsmartcols/files/data-string-extreme new file mode 100644 index 000000000..6fb395d7a --- /dev/null +++ b/tests/ts/libsmartcols/files/data-string-extreme @@ -0,0 +1,10 @@ +qqqqqqX +ddddddddX +ffffffffffffffffffffffffffffffffffX +sssX +ddX +jjjjjX +mmmmmmmX +llllllllllX +yyyyyyX +pppppX diff --git a/tests/ts/libsmartcols/files/data-string-long b/tests/ts/libsmartcols/files/data-string-long new file mode 100644 index 000000000..1b5683aa4 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-string-long @@ -0,0 +1,10 @@ +qqqqqqqqqqqqqqqqqX +dddddddddddddX +ffffffffffffffffffffffffffffffffffffffffX +ssssssssssX +ddddddddddddddddddddddddddX +jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX +mmmmmmmmmmmmmmmmmmmX +lllllllllllllllllllllllllllllllllllllX +yyyyyyyyyyyyyyyyyyyyyyyyyyyyX +pppppppppX diff --git a/tests/ts/libsmartcols/files/data-string-nl b/tests/ts/libsmartcols/files/data-string-nl new file mode 100644 index 000000000..7822e57bc --- /dev/null +++ b/tests/ts/libsmartcols/files/data-string-nl @@ -0,0 +1,10 @@ +aaa +bbbbb +cccc\nCCCC +dddddddd\nDDDD\nDD +hello\nbaby +aaa\nbbb\nccc\nddd +eee +fffff +g\nhhhhh +ppppppppp diff --git a/tests/ts/libsmartcols/fromfile b/tests/ts/libsmartcols/fromfile new file mode 100755 index 000000000..311dd7e1e --- /dev/null +++ b/tests/ts/libsmartcols/fromfile @@ -0,0 +1,240 @@ +#!/bin/bash +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="fromfile" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +TESTPROG="$TS_HELPER_LIBSMARTCOLS_FROMFILE" +ts_check_test_command "$TESTPROG" + +ts_init_subtest "tree" +$TESTPROG --nlines 10 \ + --tree-id-column 1 \ + --tree-parent-column 2 \ + --column $TS_SELF/files/col-tree \ + --column $TS_SELF/files/col-id \ + --column $TS_SELF/files/col-parent \ + --column $TS_SELF/files/col-string \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-id \ + $TS_SELF/files/data-parent \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "tree-json" +$TESTPROG --nlines 10 --json \ + --tree-id-column 1 \ + --tree-parent-column 2 \ + --column $TS_SELF/files/col-tree \ + --column $TS_SELF/files/col-id \ + --column $TS_SELF/files/col-parent \ + --column $TS_SELF/files/col-string \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-id \ + $TS_SELF/files/data-parent \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "tree-middle" +$TESTPROG --nlines 10 \ + --tree-id-column 0 \ + --tree-parent-column 1 \ + --column $TS_SELF/files/col-id \ + --column $TS_SELF/files/col-parent \ + --column $TS_SELF/files/col-tree \ + --column $TS_SELF/files/col-string \ + $TS_SELF/files/data-id \ + $TS_SELF/files/data-parent \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "tree-end" +$TESTPROG --nlines 10 \ + --tree-id-column 0 \ + --tree-parent-column 1 \ + --column $TS_SELF/files/col-id \ + --column $TS_SELF/files/col-parent \ + --column $TS_SELF/files/col-string \ + --column $TS_SELF/files/col-tree \ + $TS_SELF/files/data-id \ + $TS_SELF/files/data-parent \ + $TS_SELF/files/data-string-long \ + $TS_SELF/files/data-string \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "trunc" +$TESTPROG --nlines 10 --width 40 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-trunc \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "right" +$TESTPROG --nlines 10 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-string \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "right-maxout" +$TESTPROG --nlines 10 --maxout --width 80\ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "strictwidth" +$TESTPROG --nlines 10 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-strict \ + --column $TS_SELF/files/col-number \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number-tiny \ + $TS_SELF/files/data-number \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "noextremes" +$TESTPROG --nlines 10 --width 45 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-noextremes \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-string-extreme \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "hidden" +$TESTPROG --nlines 10 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-hidden \ + --column $TS_SELF/files/col-number \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-string-long \ + $TS_SELF/files/data-number \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "wrap" +$TESTPROG --nlines 10 --width 40 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-wrap \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "wrap-tree" +$TESTPROG --nlines 10 --width 45 \ + --tree-id-column 1 \ + --tree-parent-column 2 \ + --column $TS_SELF/files/col-tree \ + --column $TS_SELF/files/col-id \ + --column $TS_SELF/files/col-parent \ + --column $TS_SELF/files/col-wrap \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-id \ + $TS_SELF/files/data-parent \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "wrapnl" +$TESTPROG --nlines 10 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-wrapnl \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-nl \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "wrapnl-tree" +$TESTPROG --nlines 10 \ + --tree-id-column 1 \ + --tree-parent-column 2 \ + --column $TS_SELF/files/col-tree \ + --column $TS_SELF/files/col-id \ + --column $TS_SELF/files/col-parent \ + --column $TS_SELF/files/col-wrapnl \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-id \ + $TS_SELF/files/data-parent \ + $TS_SELF/files/data-string-nl \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "raw" +$TESTPROG --nlines 10 --raw \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-trunc \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "export" +$TESTPROG --nlines 10 --export \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-trunc \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "column-separator" +$TESTPROG --nlines 10 --colsep \| \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-trunc \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-long \ + >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_log "...done." +ts_finalize diff --git a/tests/ts/libsmartcols/title b/tests/ts/libsmartcols/title new file mode 100755 index 000000000..a9ba6a4fd --- /dev/null +++ b/tests/ts/libsmartcols/title @@ -0,0 +1,28 @@ +#!/bin/bash +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="title" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +TESTPROG="$TS_HELPER_LIBSMARTCOLS_TITLE" +ts_check_test_command "$TESTPROG" + +$TESTPROG --width 80 >> $TS_OUTPUT 2>&1 + +ts_finalize -- 2.14.4