3 # This file is part of util-linux.
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
17 TS_TOPDIR
="${0%/*}/../.."
20 .
$TS_TOPDIR/functions.sh
23 TESTPROG
="$TS_HELPER_LIBSMARTCOLS_FROMFILE"
24 ts_check_test_command
"$TESTPROG"
26 ts_init_subtest
"tree"
27 ts_run
$TESTPROG --nlines 10 \
29 --tree-parent-column 2 \
30 --column $TS_SELF/files
/col-tree \
31 --column $TS_SELF/files
/col-id \
32 --column $TS_SELF/files
/col-parent \
33 --column $TS_SELF/files
/col-string \
34 $TS_SELF/files
/data-string \
35 $TS_SELF/files
/data-id \
36 $TS_SELF/files
/data-parent \
37 $TS_SELF/files
/data-string-long \
38 >> $TS_OUTPUT 2>> $TS_ERRLOG
41 ts_init_subtest
"tree-json"
42 ts_run
$TESTPROG --nlines 10 --json \
44 --tree-parent-column 2 \
45 --column $TS_SELF/files
/col-tree \
46 --column $TS_SELF/files
/col-id \
47 --column $TS_SELF/files
/col-parent \
48 --column $TS_SELF/files
/col-string \
49 $TS_SELF/files
/data-string \
50 $TS_SELF/files
/data-id \
51 $TS_SELF/files
/data-parent \
52 $TS_SELF/files
/data-string-long \
53 >> $TS_OUTPUT 2>> $TS_ERRLOG
56 ts_init_subtest
"tree-middle"
57 ts_run
$TESTPROG --nlines 10 \
59 --tree-parent-column 1 \
60 --column $TS_SELF/files
/col-id \
61 --column $TS_SELF/files
/col-parent \
62 --column $TS_SELF/files
/col-tree \
63 --column $TS_SELF/files
/col-string \
64 $TS_SELF/files
/data-id \
65 $TS_SELF/files
/data-parent \
66 $TS_SELF/files
/data-string \
67 $TS_SELF/files
/data-string-long \
68 >> $TS_OUTPUT 2>> $TS_ERRLOG
71 ts_init_subtest
"tree-end"
72 ts_run
$TESTPROG --nlines 10 \
74 --tree-parent-column 1 \
75 --column $TS_SELF/files
/col-id \
76 --column $TS_SELF/files
/col-parent \
77 --column $TS_SELF/files
/col-string \
78 --column $TS_SELF/files
/col-tree \
79 $TS_SELF/files
/data-id \
80 $TS_SELF/files
/data-parent \
81 $TS_SELF/files
/data-string-long \
82 $TS_SELF/files
/data-string \
83 >> $TS_OUTPUT 2>> $TS_ERRLOG
86 ts_init_subtest
"trunc"
87 ts_run
$TESTPROG --nlines 10 --width 40 \
88 --column $TS_SELF/files
/col-name \
89 --column $TS_SELF/files
/col-number \
90 --column $TS_SELF/files
/col-trunc \
91 $TS_SELF/files
/data-string \
92 $TS_SELF/files
/data-number \
93 $TS_SELF/files
/data-string-long \
94 >> $TS_OUTPUT 2>> $TS_ERRLOG
97 ts_init_subtest
"right"
98 ts_run
$TESTPROG --nlines 10 \
99 --column $TS_SELF/files
/col-name \
100 --column $TS_SELF/files
/col-number \
101 --column $TS_SELF/files
/col-string \
102 $TS_SELF/files
/data-string \
103 $TS_SELF/files
/data-number \
104 $TS_SELF/files
/data-string-long \
105 >> $TS_OUTPUT 2>> $TS_ERRLOG
108 ts_init_subtest
"right-maxout"
109 ts_run
$TESTPROG --nlines 10 --maxout --width 80\
110 --column $TS_SELF/files
/col-name \
111 --column $TS_SELF/files
/col-number \
112 $TS_SELF/files
/data-string \
113 $TS_SELF/files
/data-number \
114 >> $TS_OUTPUT 2>> $TS_ERRLOG
117 ts_init_subtest
"padding-default"
118 export LIBSMARTCOLS_DEBUG_PADDING
=on
119 ts_run
$TESTPROG --nlines 10 --width 80 \
120 --column $TS_SELF/files
/col-name \
121 --column $TS_SELF/files
/col-number \
122 --column $TS_SELF/files
/col-string \
123 --column $TS_SELF/files
/col-string \
124 $TS_SELF/files
/data-string \
125 $TS_SELF/files
/data-number \
126 $TS_SELF/files
/data-string-empty \
127 $TS_SELF/files
/data-string-empty \
128 >> $TS_OUTPUT 2> /dev
/null
131 ts_init_subtest
"padding-maxout"
132 export LIBSMARTCOLS_DEBUG_PADDING
=on
133 ts_run
$TESTPROG --nlines 10 --width 80 \
135 --column $TS_SELF/files
/col-name \
136 --column $TS_SELF/files
/col-number \
137 --column $TS_SELF/files
/col-string \
138 --column $TS_SELF/files
/col-string \
139 $TS_SELF/files
/data-string \
140 $TS_SELF/files
/data-number \
141 $TS_SELF/files
/data-string-empty \
142 $TS_SELF/files
/data-string-empty \
143 >> $TS_OUTPUT 2> /dev
/null
146 ts_init_subtest
"padding-minout"
147 export LIBSMARTCOLS_DEBUG_PADDING
=on
148 ts_run
$TESTPROG --nlines 10 --width 80 \
150 --column $TS_SELF/files
/col-name \
151 --column $TS_SELF/files
/col-number \
152 --column $TS_SELF/files
/col-string \
153 --column $TS_SELF/files
/col-string \
154 $TS_SELF/files
/data-string \
155 $TS_SELF/files
/data-number \
156 $TS_SELF/files
/data-string-empty \
157 $TS_SELF/files
/data-string-empty \
158 >> $TS_OUTPUT 2> /dev
/null
161 unset LIBSMARTCOLS_DEBUG_PADDING
163 ts_init_subtest
"strictwidth"
164 ts_run
$TESTPROG --nlines 10 \
165 --column $TS_SELF/files
/col-name \
166 --column $TS_SELF/files
/col-strict \
167 --column $TS_SELF/files
/col-number \
168 $TS_SELF/files
/data-string \
169 $TS_SELF/files
/data-number-tiny \
170 $TS_SELF/files
/data-number \
171 >> $TS_OUTPUT 2>> $TS_ERRLOG
174 ts_init_subtest
"noextremes"
175 ts_run
$TESTPROG --nlines 10 --width 45 \
176 --column $TS_SELF/files
/col-name \
177 --column $TS_SELF/files
/col-noextremes \
178 --column $TS_SELF/files
/col-number \
179 --column $TS_SELF/files
/col-name \
180 --column $TS_SELF/files
/col-number \
181 $TS_SELF/files
/data-string \
182 $TS_SELF/files
/data-string-extreme \
183 $TS_SELF/files
/data-number \
184 $TS_SELF/files
/data-string \
185 $TS_SELF/files
/data-number \
186 >> $TS_OUTPUT 2>> $TS_ERRLOG
189 ts_init_subtest
"hidden"
190 ts_run
$TESTPROG --nlines 10 \
191 --column $TS_SELF/files
/col-name \
192 --column $TS_SELF/files
/col-hidden \
193 --column $TS_SELF/files
/col-number \
194 $TS_SELF/files
/data-string \
195 $TS_SELF/files
/data-string-long \
196 $TS_SELF/files
/data-number \
197 >> $TS_OUTPUT 2>> $TS_ERRLOG
200 ts_init_subtest
"wrap"
201 ts_run
$TESTPROG --nlines 10 --width 40 \
202 --column $TS_SELF/files
/col-name \
203 --column $TS_SELF/files
/col-number \
204 --column $TS_SELF/files
/col-wrap \
205 $TS_SELF/files
/data-string \
206 $TS_SELF/files
/data-number \
207 $TS_SELF/files
/data-string-long \
208 >> $TS_OUTPUT 2>> $TS_ERRLOG
211 ts_init_subtest
"wrap-tree"
212 ts_run
$TESTPROG --nlines 10 --width 45 \
214 --tree-parent-column 2 \
215 --column $TS_SELF/files
/col-tree \
216 --column $TS_SELF/files
/col-id \
217 --column $TS_SELF/files
/col-parent \
218 --column $TS_SELF/files
/col-wrap \
219 $TS_SELF/files
/data-string \
220 $TS_SELF/files
/data-id \
221 $TS_SELF/files
/data-parent \
222 $TS_SELF/files
/data-string-long \
223 >> $TS_OUTPUT 2>> $TS_ERRLOG
226 ts_init_subtest
"wrapnl"
227 ts_run
$TESTPROG --nlines 10 \
228 --column $TS_SELF/files
/col-name \
229 --column $TS_SELF/files
/col-number \
230 --column $TS_SELF/files
/col-wrapnl \
231 $TS_SELF/files
/data-string \
232 $TS_SELF/files
/data-number \
233 $TS_SELF/files
/data-string-nl \
234 >> $TS_OUTPUT 2>> $TS_ERRLOG
237 ts_init_subtest
"wrapnl-tree"
238 ts_run
$TESTPROG --nlines 10 \
240 --tree-parent-column 2 \
241 --column $TS_SELF/files
/col-tree \
242 --column $TS_SELF/files
/col-id \
243 --column $TS_SELF/files
/col-parent \
244 --column $TS_SELF/files
/col-wrapnl \
245 $TS_SELF/files
/data-string \
246 $TS_SELF/files
/data-id \
247 $TS_SELF/files
/data-parent \
248 $TS_SELF/files
/data-string-nl \
249 >> $TS_OUTPUT 2>> $TS_ERRLOG
252 ts_init_subtest
"raw"
253 ts_run
$TESTPROG --nlines 10 --raw \
254 --column $TS_SELF/files
/col-name \
255 --column $TS_SELF/files
/col-number \
256 --column $TS_SELF/files
/col-trunc \
257 $TS_SELF/files
/data-string \
258 $TS_SELF/files
/data-number \
259 $TS_SELF/files
/data-string-long \
260 >> $TS_OUTPUT 2>> $TS_ERRLOG
263 ts_init_subtest
"export"
264 ts_run
$TESTPROG --nlines 10 --export \
265 --column $TS_SELF/files
/col-name \
266 --column $TS_SELF/files
/col-number \
267 --column $TS_SELF/files
/col-trunc \
268 $TS_SELF/files
/data-string \
269 $TS_SELF/files
/data-number \
270 $TS_SELF/files
/data-string-long \
271 >> $TS_OUTPUT 2>> $TS_ERRLOG
274 ts_init_subtest
"column-separator"
275 ts_run
$TESTPROG --nlines 10 --colsep \| \
276 --column $TS_SELF/files
/col-name \
277 --column $TS_SELF/files
/col-number \
278 --column $TS_SELF/files
/col-trunc \
279 $TS_SELF/files
/data-string \
280 $TS_SELF/files
/data-number \
281 $TS_SELF/files
/data-string-long \
282 >> $TS_OUTPUT 2>> $TS_ERRLOG