X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=blobdiff_plain;f=t%2F80-leaks.t;h=9ccc1a38429e3ca787c176eab238491d189781ba;hp=6916936327e0ad0c2c3c2e626c791296eefc22ce;hb=2ccccc5e7ea3f299777e0b67db864a1ea60688a6;hpb=2e52ce0819fd8c02f7b5c13dbea35d4e44568cde diff --git a/t/80-leaks.t b/t/80-leaks.t index 6916936..9ccc1a3 100644 --- a/t/80-leaks.t +++ b/t/80-leaks.t @@ -9,7 +9,7 @@ use Test::More; BEGIN { my $tests = 11; - $tests += 3 * (4 + (MGf_LOCAL ? 1 : 0) + (VMG_UVAR ? 4 : 0)); + $tests += 4 * (4 + (MGf_LOCAL ? 1 : 0) + (VMG_UVAR ? 4 : 0)); plan tests => $tests; } @@ -115,11 +115,13 @@ $type{$_} = 'scalar_global' for qw; $type{$_} = 'array' for qw; $type{$_} = 'hash' for qw; +sub void { } + my %trigger = ( get => 'my $y = $x', set => '$x = 2', clear => '@a = ()', - free => '', + free => 'void()', local => 'local $X = 2', fetch => 'my $v = $h{a}', store => '$h{a} = 2', @@ -135,16 +137,18 @@ for my $meth (@methods) { my $init = $init{$type{$meth}}; my $trigger = $trigger{$meth}; + my $deinit = ''; if ($meth eq 'free') { - $init = "{\n$init"; - $trigger = '}'; + $init = "{\n$init"; + $deinit = '}'; } my $code = join ";\n", grep length, ( $init, 'is $destroyed, 0, "return from $meth, before trigger"', - $trigger, + $trigger . ', is($destroyed, 0, "return from $meth, after trigger")', + $deinit, 'is $destroyed, 1, "return from $meth, after trigger"', );