diff options
Diffstat (limited to 'tests/ts/libsmartcols')
23 files changed, 440 insertions, 0 deletions
diff --git a/tests/ts/libsmartcols/files/col-hidden b/tests/ts/libsmartcols/files/col-hidden new file mode 100644 index 0000000..83182a8 --- /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 0000000..0188f42 --- /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 0000000..0a98f29 --- /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 0000000..715edce --- /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 0000000..34a70e4 --- /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 0000000..86fe08c --- /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 0000000..62bb96b --- /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 0000000..7e2904b --- /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 0000000..5076880 --- /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 0000000..2887b43 --- /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 0000000..dc4ca34 --- /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 0000000..0a18fd1 --- /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 0000000..f00c965 --- /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 0000000..562d750 --- /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 0000000..8b1acc1 --- /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 0000000..aa50716 --- /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 0000000..dff6e9c --- /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-empty b/tests/ts/libsmartcols/files/data-string-empty new file mode 100644 index 0000000..1f8ad34 --- /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/files/data-string-extreme b/tests/ts/libsmartcols/files/data-string-extreme new file mode 100644 index 0000000..6fb395d --- /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 0000000..1b5683a --- /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 0000000..7822e57 --- /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 0000000..45b8471 --- /dev/null +++ b/tests/ts/libsmartcols/fromfile @@ -0,0 +1,286 @@ +#!/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" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "tree-json" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "tree-middle" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "tree-end" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "trunc" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "right" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "right-maxout" +ts_run $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>> $TS_ERRLOG +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 \ + --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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "noextremes" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "hidden" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "wrap" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "wrap-tree" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "wrapnl" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "wrapnl-tree" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "raw" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "export" +ts_run $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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "column-separator" +ts_run $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>> $TS_ERRLOG +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 0000000..5a1c178 --- /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" + +ts_run $TESTPROG --width 80 >> $TS_OUTPUT 2>> $TS_ERRLOG + +ts_finalize |