]> git.vpit.fr Git - perl/modules/Scalar-Vec-Util.git/blobdiff - t/21-vfill.t
Switch to qw<>
[perl/modules/Scalar-Vec-Util.git] / t / 21-vfill.t
index 33565f954bcb9b89adee5a838ad396a25ef0019c..84031743e370403f2a8b1e464128a1b17c7f8290 100644 (file)
@@ -5,16 +5,14 @@ use warnings;
 
 use Test::More 'no_plan';
 
-use Scalar::Vec::Util qw/vfill SVU_SIZE/;
-
-eval { vfill undef, 0, 0, 0 };
-like($@, qr/Invalid\s+argument/, 'first argument undef croaks');
-eval { vfill my $x, undef, 0, 0 };
-like($@, qr/Invalid\s+argument/, 'second argument undef croaks');
-eval { vfill my $x, 0, undef, 0 };
-like($@, qr/Invalid\s+argument/, 'third argument undef croaks');
-eval { vfill my $x, 0, 0, undef };
-like($@, qr/Invalid\s+argument/, 'fourth argument undef croaks');
+use Scalar::Vec::Util qw<vfill SVU_SIZE>;
+
+for ([ 1, 'offset', -1 ], [ 2, 'length', '-1' ]) {
+ my @args  = (~0) x 4;
+ $args[$_->[0]] = $_->[2];
+ eval { &vfill(@args) }; my $line = __LINE__;
+ like $@, qr/^Invalid\s+negative\s+$_->[1]\s+at\s+\Q$0\E\s+line\s+$line/;
+}
 
 my $p = SVU_SIZE;
 $p = 8 if $p < 8;