X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FPerl-Critic-Policy-Dynamic-NoIndirect.git;a=blobdiff_plain;f=t%2F10-basic.t;h=55215c40110bc19d09d86893aa21b60d45224aea;hp=399e5529516439e531964e572df0a08d3dbb7eda;hb=ef89faf5a36a866b83462cad90209f9cc68a7e41;hpb=953c765f87448964b3818e2617e8186e1545a7e1 diff --git a/t/10-basic.t b/t/10-basic.t index 399e552..55215c4 100644 --- a/t/10-basic.t +++ b/t/10-basic.t @@ -5,8 +5,8 @@ use warnings; my ($tests, $reports, $subtests); BEGIN { - $tests = 15; - $reports = 25; + $tests = 25; + $reports = 42; $subtests = 3; } @@ -24,6 +24,8 @@ sub expect { qr/^Indirect call of method \"\Q$meth\E\" on $obj/, } +sub zap (&) { } + { local $/ = "####"; @@ -139,3 +141,56 @@ my $x = new $obj; ---- [ 'new', '$obj', 2, 9 ], [ 'new', '$obj', 3, 7 ] +#### +my $x = main::zap { }; +---- +#### +my $x = meh { }; +---- +[ 'meh', '{', 1, 9 ] +#### +my $x = meh { + 1 +}; +---- +[ 'meh', '{', 1, 9 ] +#### +my $x = + meh { 1; 1 + }; +---- +[ 'meh', '{', 2, 2 ] +#### +my $x = meh { + new X; +}; +---- +[ 'meh', '{', 1, 9 ], [ 'new', 'X', 2, 2 ] +#### +our $obj; +my $x = meh { + new $obj; +} +---- +[ 'meh', '{', 2, 9 ], [ 'new', '$obj', 3, 2 ] +#### +my $x = meh { } new + X; +---- +[ 'meh', '{', 1, 9 ], [ 'new', 'X', 1, 17 ] +#### +our $obj; +my $x = meh { } new + $obj; +---- +[ 'meh', '{', 2, 9 ], [ 'new', '$obj', 2, 17 ] +#### +our $obj; +my $x = meh { new X } new $obj; +---- +[ 'meh', '{', 2, 9 ], [ 'new', 'X', 2, 15 ], [ 'new', '$obj', 2, 23 ] +#### +our $obj; +my $x = meh { new $obj } new X; +---- +[ 'meh', '{', 2, 9 ], [ 'new', '$obj', 2, 15 ], [ 'new', 'X', 2, 26 ]