mirror of
https://github.com/ericonr/util-linux.git
synced 2024-04-21 09:12:35 -05:00
tests: improve libsmartcols test
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
19055a25ed
commit
a414a17093
@ -156,6 +156,7 @@ int main(int argc, char *argv[])
|
|||||||
{ "maxout", 0, 0, 'm' },
|
{ "maxout", 0, 0, 'm' },
|
||||||
{ "column", 1, 0, 'c' },
|
{ "column", 1, 0, 'c' },
|
||||||
{ "nlines", 1, 0, 'n' },
|
{ "nlines", 1, 0, 'n' },
|
||||||
|
{ "width", 1, 0, 'w' },
|
||||||
{ NULL, 0, 0, 0 },
|
{ NULL, 0, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,7 +168,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!tb)
|
if (!tb)
|
||||||
err(EXIT_FAILURE, "failed to create output table");
|
err(EXIT_FAILURE, "failed to create output table");
|
||||||
|
|
||||||
while((c = getopt_long(argc, argv, "c:mn:", longopts, NULL)) != -1) {
|
while((c = getopt_long(argc, argv, "c:mn:w:", longopts, NULL)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'c': /* add column from file */
|
case 'c': /* add column from file */
|
||||||
{
|
{
|
||||||
@ -189,6 +190,10 @@ int main(int argc, char *argv[])
|
|||||||
case 'n':
|
case 'n':
|
||||||
nlines = strtou32_or_err(optarg, "failed to parse number of lines");
|
nlines = strtou32_or_err(optarg, "failed to parse number of lines");
|
||||||
break;
|
break;
|
||||||
|
case 'w':
|
||||||
|
scols_table_set_termforce(tb, SCOLS_TERMFORCE_ALWAYS);
|
||||||
|
scols_table_set_termwidth(tb, strtou32_or_err(optarg, "failed to parse terminal width"));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
err(EXIT_FAILURE, "%s [-r|--random]\n", program_invocation_short_name);
|
err(EXIT_FAILURE, "%s [-r|--random]\n", program_invocation_short_name);
|
||||||
}
|
}
|
||||||
|
11
tests/expected/libsmartcols/fromfile-right-maxout
Normal file
11
tests/expected/libsmartcols/fromfile-right-maxout
Normal file
@ -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
|
@ -35,6 +35,15 @@ $TESTPROG --nlines 10 \
|
|||||||
>> $TS_OUTPUT 2>&1
|
>> $TS_OUTPUT 2>&1
|
||||||
ts_finalize_subtest
|
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 "wrapnl"
|
ts_init_subtest "wrapnl"
|
||||||
$TESTPROG --nlines 10 \
|
$TESTPROG --nlines 10 \
|
||||||
--column $TS_SELF/files/col-name \
|
--column $TS_SELF/files/col-name \
|
||||||
|
Loading…
Reference in New Issue
Block a user