comm,join: ensure warnings are apparent upon exit

* src/comm.c (main): Output a warning right before exit,
in case previous errors have scrolled from view.
* src/join.c (main): Likewise.
* tests/misc/comm.pl: Addjust accordingly.
* tests/misc/join.pl: Likewise.
Fixes https://bugs.gnu.org/34347
This commit is contained in:
Pádraig Brady committed 2019-02-11 22:56:21 -08:00
1 parent 620112526b
commit 636cbdb77b
4 files changed
+18 -9

No files matched your search

+1 -1
View File
@@ -493,7 +493,7 @@ main (int argc, char **argv)
compare_files (argv + optind);
if (issued_disorder_warning[0] || issued_disorder_warning[1])
return EXIT_FAILURE;
die (EXIT_FAILURE, 0, _("input is not in sorted order"));
else
return EXIT_SUCCESS;
}
+1 -1
View File
@@ -1193,7 +1193,7 @@ main (int argc, char **argv)
die (EXIT_FAILURE, errno, "%s", quotef (g_names[1]));
if (issued_disorder_warning[0] || issued_disorder_warning[1])
return EXIT_FAILURE;
die (EXIT_FAILURE, 0, _("input is not in sorted order"));
else
return EXIT_SUCCESS;
}
+10 -5
View File
@@ -89,7 +89,8 @@ my @Tests =
# out-of-order input
['ooo', {IN=>{a=>"1\n3"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
{OUT => "1\n\t\t3\n\t2\n"},
{ERR => "$prog: file 2 is not in sorted order\n"}],
{ERR => "$prog: file 2 is not in sorted order\n"
. "$prog: input is not in sorted order\n"}],
# out-of-order input, fatal
['ooo2', '--check-order', {IN=>{a=>"1\n3"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
@@ -104,23 +105,27 @@ my @Tests =
['ooo4', {IN=>{a=>"3\n1\n0"}}, {IN=>{b=>"3\n2\n0"}}, {EXIT=>1},
{OUT => "\t\t3\n1\n0\n\t2\n\t0\n"},
{ERR => "$prog: file 1 is not in sorted order\n".
"$prog: file 2 is not in sorted order\n" }],
"$prog: file 2 is not in sorted order\n"
. "$prog: input is not in sorted order\n"}],
# both inputs out-of-order on last pair
['ooo5', {IN=>{a=>"3\n1"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
{OUT => "\t\t3\n1\n\t2\n"},
{ERR => "$prog: file 1 is not in sorted order\n".
"$prog: file 2 is not in sorted order\n" }],
"$prog: file 2 is not in sorted order\n"
. "$prog: input is not in sorted order\n"}],
# first input out-of-order extended
['ooo5b', {IN=>{a=>"0\n3\n1"}}, {IN=>{b=>"2\n3"}}, {EXIT=>1},
{OUT => "0\n\t2\n\t\t3\n1\n"},
{ERR => "$prog: file 1 is not in sorted order\n"}],
{ERR => "$prog: file 1 is not in sorted order\n"
. "$prog: input is not in sorted order\n"}],
# second input out-of-order extended
['ooo5c', {IN=>{a=>"0\n3"}}, {IN=>{b=>"2\n3\n1"}}, {EXIT=>1},
{OUT => "0\n\t2\n\t\t3\n\t1\n"},
{ERR => "$prog: file 2 is not in sorted order\n"}],
{ERR => "$prog: file 2 is not in sorted order\n"
. "$prog: input is not in sorted order\n"}],
# both inputs out-of-order, but fully pairable
['ooo6', {IN=>{a=>"2\n1\n0"}}, {IN=>{b=>"2\n1\n0"}}, {EXIT=>0},
+6 -2
View File
@@ -216,13 +216,17 @@ my @tv = (
['chkodr-5d', '',
["a\nx\n\n", "b\ny\n\n"], "", 1,
"$prog: chkodr-5d.1:3: is not sorted: \n" .
"$prog: chkodr-5d.2:3: is not sorted: \n"],
"$prog: chkodr-5d.2:3: is not sorted: \n" .
"$prog: input is not in sorted order\n"
],
# Similar, but make it so each offending line has no newline.
['chkodr-5e', '',
["a\nx\no", "b\ny\np"], "", 1,
"$prog: chkodr-5e.1:3: is not sorted: o\n" .
"$prog: chkodr-5e.2:3: is not sorted: p\n"],
"$prog: chkodr-5e.2:3: is not sorted: p\n" .
"$prog: input is not in sorted order\n"
],
# Without order check, both inputs out of order and some lines
# unpairable. This is NOT supported by the GNU extension. All that