X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fmethod-no-semi.t;h=1bcfd2a942527b69e20fef8cf1a1e2f83aae7bf0;hb=8aa609aed8c1042b5c9ffa49b4363eabde131d53;hp=731584f42f34a6bb8aff29e1b7b1255d0c6245f4;hpb=ce7f7bf0fcbb68e2829c8f26a2d2de9cc196b09f;p=p5sagit%2FDevel-Declare.git diff --git a/t/method-no-semi.t b/t/method-no-semi.t index 731584f..1bcfd2a 100644 --- a/t/method-no-semi.t +++ b/t/method-no-semi.t @@ -1,11 +1,13 @@ +use strict; +use warnings; use Devel::Declare (); -use Scope::Guard; { package MethodHandlers; use strict; use warnings; + use B::Hooks::EndOfScope; our ($Declarator, $Offset); @@ -100,13 +102,12 @@ use Scope::Guard; } sub inject_scope { - $^H |= 0x120000; - $^H{DD_METHODHANDLERS} = Scope::Guard->new(sub { + on_scope_end { my $linestr = Devel::Declare::get_linestr; my $offset = Devel::Declare::get_linestr_offset; substr($linestr, $offset, 0) = ';'; Devel::Declare::set_linestr($linestr); - }); + }; } } @@ -155,7 +156,7 @@ my ($test_method1, $test_method2, @test_list); } -use Test::More 'no_plan'; +use Test::More 0.88; my $o = DeclareTest->new(attr => "value"); @@ -178,3 +179,5 @@ is($o->$test_method1('no', 'yes'), 'value, yes', 'anon method with @_ ok'); is($o->$test_method2('this'), 'DeclareTest2, this', 'anon method with proto ok'); is_deeply([ map { $_->() } @test_list ], [ 1, 2, 3, 4], 'binding ok'); + +done_testing;