From: Vincent Pit Date: Thu, 25 Aug 2011 09:55:53 +0000 (+0200) Subject: Adapt tests for the + prototype X-Git-Tag: v0.10~4 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Prototype-Util.git;a=commitdiff_plain;h=cb4330ca38fd217d3886ea0fb161e5cc3ccdfd2c Adapt tests for the + prototype --- diff --git a/t/11-wrap.t b/t/11-wrap.t index 4f88d76..a8fbb60 100644 --- a/t/11-wrap.t +++ b/t/11-wrap.t @@ -31,7 +31,8 @@ eval { wrap 'hlagh', qw }; like $@, exception('Optional arguments'), 'recall takes options in a key => value list'; -my $push_exp = '{ CORE::push(@{$_[0]}, @_[1..$#_]) }'; +my $push_exp = "$]" >= 5.013007 ? '{ CORE::push($_[0], @_[1..$#_]) }' + : '{ CORE::push(@{$_[0]}, @_[1..$#_]) }'; my $push = wrap 'CORE::push', compile => 0; is($push, 'sub ' . $push_exp, 'wrap push as a sub (default)'); $push = wrap 'CORE::push', sub => 1, compile => 0; @@ -139,7 +140,8 @@ if ("$]" >= 5.010) { is_deeply(\@a, [ qw, 3, 4, 6, 7 ], '_ without arguments'); } -eval { wrap { 'main::dummy' => '\[@%]' }, ref => 'shift' }; -like $@, - qr/to\s+shift\s+must\s+be\s+array +\([\w ]+\) +at\s+\Q$0\E\s+line\s+\d+/, +sub myshift (;\@) { shift @{$_[0]} } + +eval { wrap { 'main::dummy' => '\[@%]' }, ref => 'main::myshift' }; +like $@, qr/to main::myshift must be array \([\w ]+\) at \Q$0\E line \d+/, 'invalid eval code croaks';