X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FB%2Ft%2Flint.t;h=f62adc2f38ecba45ec98c177de80c83ed46e7283;hb=fdecdb95df591262b9afbfa09e74e71f92af065a;hp=05d53d8ca4b5664f2fe90d4bffb99554e3ea6bf0;hpb=9b494a7e378ba156401fa90333424582b0fcf907;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/B/t/lint.t b/ext/B/t/lint.t index 05d53d8..f62adc2 100644 --- a/ext/B/t/lint.t +++ b/ext/B/t/lint.t @@ -17,7 +17,7 @@ BEGIN { require 'test.pl'; } -plan tests => 28; +plan tests => 29; # Runs a separate perl interpreter with the appropriate lint options # turned on @@ -67,16 +67,6 @@ runlint 'implicit-write', 's/foo/bar/', <<'RESULT'; Implicit substitution on $_ at -e line 1 RESULT -{ - my $res = runperl( - switches => ["-MB::Lint"], - prog => - 'BEGIN{B::Lint->register_plugin(X=>[q[x]])};use O(qw[Lint x]);sub X::match{warn qq[X ok.\n]};dummy()', - stderr => 1, - ); - like( $res, qr/X ok\./, 'Lint plugin' ); -} - runlint 'implicit-read', 'for ( @ARGV ) { 1 }', <<'RESULT', 'implicit-read in foreach'; Implicit use of $_ in foreach at -e line 1 @@ -88,9 +78,9 @@ runlint 'dollar-underscore', '$_ = 1', <<'RESULT'; Use of $_ at -e line 1 RESULT -runlint 'dollar-underscore', 'foo( $_ ) for @A', ''; -runlint 'dollar-underscore', 'map { foo( $_ ) } @A', ''; -runlint 'dollar-underscore', 'grep { foo( $_ ) } @A', ''; +runlint 'dollar-underscore', 'sub foo {}; foo( $_ ) for @A', ''; +runlint 'dollar-underscore', 'sub foo {}; map { foo( $_ ) } @A', ''; +runlint 'dollar-underscore', 'sub foo {}; grep { foo( $_ ) } @A', ''; runlint 'dollar-underscore', 'print', <<'RESULT', 'dollar-underscore in print'; @@ -132,3 +122,27 @@ runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]; $x=$y{bare}', <<'RESULT'; Bare sub name 'bare' interpreted as string at -e line 1 Bare sub name 'bare' interpreted as string at -e line 1 RESULT + +{ + + # Check for backwards-compatible plugin support. This was where + # preloaded mdoules would register themselves with B::Lint. + my $res = runperl( + switches => ["-MB::Lint"], + prog => + 'BEGIN{B::Lint->register_plugin(X=>[q[x]])};use O(qw[Lint x]);sub X::match{warn qq[X ok.\n]};dummy()', + stderr => 1, + ); + like( $res, qr/X ok\./, 'Lint legacy plugin' ); +} + +{ + + # Check for Module::Plugin support + my $res = runperl( + switches => [ '-I../ext/B/t/pluglib', '-MO=Lint,none' ], + prog => 1, + stderr => 1, + ); + like( $res, qr/Module::Pluggable ok\./, 'Lint uses Module::Pluggable' ); +}