summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2016-04-14 12:38:09 +0200
committerBernhard Voelker <mail@bernhard-voelker.de>2016-04-14 12:38:09 +0200
commit81e589021d9c47e4fbc4284e82881a9703246476 (patch)
tree2258556550b9c8155e54cfcf3e50bc2745a52574 /tests
parent8faf269250e8eff5f5dd164dfa1d661c34f52ade (diff)
downloadcoreutils-81e589021d9c47e4fbc4284e82881a9703246476.tar.xz
seq: do not allow 0 as increment value
* src/seq.c (main): Exit with an error diagnostic when the given step value is Zero. (usage): Document it. * doc/coreutils.texi (seq invocation): Likewise. * tests/misc/seq.pl: Add tests. * NEWS (Changes in behavior): Mention the change. Reported by Маренков Евгений in: http://bugs.gnu.org/23110
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/seq.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl
index 6564415d4..ac0664fc6 100755
--- a/tests/misc/seq.pl
+++ b/tests/misc/seq.pl
@@ -25,6 +25,7 @@ use strict;
my $prog = 'seq';
my $try_help = "Try '$prog --help' for more information.\n";
+my $err_inc_zero = "seq: invalid Zero increment value: '0'\n".$try_help;
my $locale = $ENV{LOCALE_FR_UTF8};
! defined $locale || $locale eq 'none'
@@ -151,6 +152,15 @@ my @Tests =
['fast-1', qw(4), {OUT => [qw(1 2 3 4)]}],
['fast-2', qw(1 4), {OUT => [qw(1 2 3 4)]}],
['fast-3', qw(1 1 4), {OUT => [qw(1 2 3 4)]}],
+
+ # Ensure an INCREMENT of Zero is rejected.
+ ['inc-zero-1', qw(1 0 10), {EXIT => 1}, {ERR => $err_inc_zero}],
+ ['inc-zero-2', qw(0 -0 0), {EXIT => 1}, {ERR => $err_inc_zero},
+ {ERR_SUBST => 's/-0/0/'}],
+ ['inc-zero-3', qw(1 0.0 10), {EXIT => 1},{ERR => $err_inc_zero},
+ {ERR_SUBST => 's/0.0/0/'}],
+ ['inc-zero-4', qw(1 -0.0e-10 10), {EXIT => 1},{ERR => $err_inc_zero},
+ {ERR_SUBST => 's/-0\.0e-10/0/'}],
);
# Append a newline to each entry in the OUT array.