X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F31-vcopy-copy.t;h=68b136bf4bc317946f16fd006d25cf9eb809c4eb;hb=0f9ca88734df707e9f1d70a8067e6502b96820a9;hp=2d1132d4a5e3843525a3313990830973f4d49f76;hpb=f77706f0734eb34a9623cc492b5d73061fba9b62;p=perl%2Fmodules%2FScalar-Vec-Util.git diff --git a/t/31-vcopy-copy.t b/t/31-vcopy-copy.t index 2d1132d..68b136b 100644 --- a/t/31-vcopy-copy.t +++ b/t/31-vcopy-copy.t @@ -3,20 +3,17 @@ use strict; use warnings; -use Test::More 'no_plan'; - -use Scalar::Vec::Util qw/vcopy SVU_SIZE/; - -eval { vcopy undef, 0, my $y, 0, 0 }; -like($@, qr/Invalid\s+argument/, 'first argument undef croaks'); -eval { vcopy my $x, undef, my $y, 0, 0 }; -like($@, qr/Invalid\s+argument/, 'second argument undef croaks'); -eval { vcopy my $x, 0, undef, 0, 0 }; -like($@, qr/Invalid\s+argument/, 'third argument undef croaks'); -eval { vcopy my $x, 0, my $y, undef, 0 }; -like($@, qr/Invalid\s+argument/, 'fourth argument undef croaks'); -eval { vcopy my $x, 0, my $y, 0, undef }; -like($@, qr/Invalid\s+argument/, 'fifth argument undef croaks'); +use lib 't/lib'; +use Test::Leaner 'no_plan'; + +use Scalar::Vec::Util qw; + +for ([ 1, 'offset', -1 ], [ 3, 'offset', '-1' ], [ 4, 'length', -1 ]) { + my @args = (~0) x 5; + $args[$_->[0]] = $_->[2]; + eval { &vcopy(@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;