X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F21-vfill.t;h=84031743e370403f2a8b1e464128a1b17c7f8290;hb=0f9ca88734df707e9f1d70a8067e6502b96820a9;hp=33565f954bcb9b89adee5a838ad396a25ef0019c;hpb=f77706f0734eb34a9623cc492b5d73061fba9b62;p=perl%2Fmodules%2FScalar-Vec-Util.git diff --git a/t/21-vfill.t b/t/21-vfill.t index 33565f9..8403174 100644 --- a/t/21-vfill.t +++ b/t/21-vfill.t @@ -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; + +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;