1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
use warnings;
use strict;
use Test::More tests => 10;
use FindBin;
for my $fail (
map ["$FindBin::Bin/strict_$_->[0].fail", @$_[1 .. $#$_]],
['1', qr/"\$z" can't appear after slurpy parameter "\@y\"/],
['2', qr/"\$y" can't appear after slurpy parameter "\@x\"/],
['3', qr/"\$z" can't appear after slurpy parameter "%y\"/],
['4', qr/"\@z" can't appear after slurpy parameter "\@y\"/],
['5', qr/Invalid.*rarity/],
) {
my ($file, $pat) = @$fail;
$@ = undef;
my $done = do $file;
my $exc = $@;
my $err = $!;
is $done, undef, "faulty code doesn't load - $file";
$exc or die "$file: $err" if $err;
like $exc, $pat;
}
|