summaryrefslogtreecommitdiff
path: root/tests/factor
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-10-01 08:02:09 +0000
committerJim Meyering <jim@meyering.net>2005-10-01 08:02:09 +0000
commit5c8ecd28312a5e9979bb4789e623cd9db8796ede (patch)
tree5557a6410d621585b79b16a595dd9f089f51dece /tests/factor
parent9c06ae5cffb7b4bdebda643c94891ebf479a828e (diff)
downloadcoreutils-5c8ecd28312a5e9979bb4789e623cd9db8796ede.tar.xz
Add a test for this:
(main): Don't stop processing arguments upon the first invalid one.
Diffstat (limited to 'tests/factor')
-rwxr-xr-xtests/factor/basic21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/factor/basic b/tests/factor/basic
index 4ecd8a06a..b819c5ae5 100755
--- a/tests/factor/basic
+++ b/tests/factor/basic
@@ -58,19 +58,32 @@ my @Tests =
{ERR => "$prog: invalid option -- 1\n"
. "Try `$prog --help' for more information.\n"},
{EXIT => 1}],
+ ['cont', 'a 4',
+ {OUT => "4: 2 2\n"},
+ {ERR => "$prog: `a' is not a valid positive integer\n"},
+ {EXIT => 1}],
);
# Prepend the command line argument and append a newline to end
# of each expected `OUT' string.
my $t;
+
+Test:
foreach $t (@Tests)
{
my $arg1 = $t->[1];
- my $e;
- foreach $e (@$t)
+
+ # Don't fiddle with expected OUT string if there's a nonzero exit status.
+ foreach my $e (@$t)
+ {
+ ref $e eq 'HASH' && exists $e->{EXIT} && $e->{EXIT}
+ and next Test;
+ }
+
+ foreach my $e (@$t)
{
- $e->{OUT} = "$arg1: $e->{OUT}\n"
- if ref $e eq 'HASH' and exists $e->{OUT};
+ ref $e eq 'HASH' && exists $e->{OUT}
+ and $e->{OUT} = "$arg1: $e->{OUT}\n"
}
}