From: Lukas Mai Date: Tue, 9 Aug 2011 09:26:13 +0000 (+0200) Subject: amend tests to match implementation X-Git-Tag: v0.05_01~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6f61373ba1c76168ddc018394ea033f5eb78776e;p=p5sagit%2FFunction-Parameters.git amend tests to match implementation --- diff --git a/t/named.t b/t/named.t index e5f836d..b451426 100644 --- a/t/named.t +++ b/t/named.t @@ -1,7 +1,7 @@ use warnings; use strict; -use Test::More tests => 4; +use Test::More tests => 12; use Dir::Self; @@ -31,19 +31,25 @@ method bar($k, $d) { } is foo('a', 'b', 'c'), 'bacb'; -is bar({ab => 'cd'}, 'ab', 'e'), 'eabcdeab'; +is bar({ab => 'cd'}, 'ab', 'e'), 'abecdabe'; my $baz = f ($x) { $x * 2 + 1 }; is $baz->(11), 23; is $baz->(-0.5), 0; -for my $fail (map [__DIR__ . "/named_$_.fail"], '1', '2', '3', '4') { - my ($file) = @$fail; +for my $fail ( + map [__DIR__ . "/named_$_->[0].fail", @$_[1 .. $#$_]], + ['1', qr/expect.*function.*name/], + ['2', qr/expect.*function.*body/], + ['3', qr/expect.*function.*name/], + ['4', qr/Global symbol "\$self" requires explicit package name/] +) { + my ($file, $pat) = @$fail; my $done = do $file; my $exc = $@; my $err = $!; is $done, undef, "faulty code doesn't load"; $exc or die "$file: $err"; - warn "$exc\n"; + like $exc, $pat; }