From: Jim Meyering Date: Sat, 26 Sep 1998 15:32:31 +0000 (+0000) Subject: Add a test for negative argument. X-Git-Tag: FILEUTILS-3_16z~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d679ddd8399029d526a318c84baaacfc3be76e11;p=thirdparty%2Fcoreutils.git Add a test for negative argument. Tweak postprocessing framework. --- diff --git a/tests/factor/Test.pm b/tests/factor/Test.pm index 1f1c540489..ea6e8766b6 100644 --- a/tests/factor/Test.pm +++ b/tests/factor/Test.pm @@ -39,6 +39,7 @@ sub test_vector ['w', '4294966464', {}, '2 2 2 2 2 2 3 3 3 2485513', 0], ['x', '4294966896', {}, '2 2 2 2 3 3 3 11 607 1489', 0], ['y', '4294966998', {}, '2 3 7 3917 26107', 0], + ['z', '-1', {}, '', 1], ); my @tv; @@ -47,7 +48,8 @@ sub test_vector { my ($test_name, $arg, $in, $exp, $ret) = @$t; # Append a newline to end of each expected string. - push (@tv, [$test_name, $arg, $in, "$arg: $exp\n", $ret]); + my $prefixed_result = ($ret == 0 ? "$arg: $exp\n" : $exp); + push (@tv, [$test_name, $arg, $in, $prefixed_result, $ret]); } return @tv;