X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F10-basic.t;h=29c2f103670bbdb913bdcb2dd3417f9fd88c8055;hb=ba8eb2c0e9b3b9a75dc7fd128e722b1a0eef8b75;hp=abf5a3d2b64eb3844c2146593e06ad46d6bd54c6;hpb=c2e8dfbf550e0a15ff415a698c806e1fc8ca03fe;p=perl%2Fmodules%2FPerl-Critic-Policy-Dynamic-NoIndirect.git diff --git a/t/10-basic.t b/t/10-basic.t index abf5a3d..29c2f10 100644 --- a/t/10-basic.t +++ b/t/10-basic.t @@ -3,10 +3,13 @@ use strict; use warnings; -my $subtests; -BEGIN { $subtests = 3 } +my ($tests, $subtests); +BEGIN { + $tests = 13; + $subtests = 3; +} -use Test::More tests => $subtests * 14; +use Test::More tests => $tests + $subtests * 21; use Perl::Critic::TestUtils qw/pcritique_with_violations/; @@ -32,6 +35,8 @@ my $policy = 'Dynamic::NoIndirect'; next; } + is @violations, @expected, "right count of violations $id"; + for my $v (@violations) { my $exp = shift @expected; @@ -72,6 +77,21 @@ my $y = new X; ---- [ 'new', 'X', 1, 9 ], [ 'new', 'X', 2, 9 ] #### +my $x = new + X; +---- +[ 'new', 'X', 1, 9 ] +#### +my $x = new + X new + X; +---- +[ 'new', 'X', 1, 9 ], [ 'new', 'X', 2, 4 ] +#### +my $x = new new; +---- +[ 'new', 'new', 1, 9 ] +#### our $obj; my $x = new $obj; ---- @@ -92,4 +112,16 @@ my $x = new $obj; my $y = new $obj; ---- [ 'new', '$obj', 2, 9 ], [ 'new', '$obj', 3, 9 ] - +#### +our $obj; +my $x = new + $obj; +---- +[ 'new', '$obj', 2, 9 ] +#### +our $obj; +my $x = new + $obj new + $obj; +---- +[ 'new', '$obj', 2, 9 ], [ 'new', '$obj', 3, 7 ]