Skip tests that require Data::Dumper if it is not built
[p5sagit/p5-mst-13.2.git] / ext / B / t / lint.t
index 2d4e680..2b49024 100644 (file)
@@ -3,10 +3,15 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = qw(../lib);
+    require Config;
+    if (($Config::Config{'extensions'} !~ /\bB\b/) ){
+        print "1..0 # Skip -- Perl configured without B module\n";
+        exit 0;
+    }
     require './test.pl';
 }
 
-plan tests => 13;
+plan tests => 15; # adjust also number of skipped tests !
 
 # Runs a separate perl interpreter with the appropriate lint options
 # turned on
@@ -40,8 +45,8 @@ RESULT
 SKIP : {
 
     use Config;
-    skip("Doesn't work with threaded perls",9)
-       if $Config{useithreads};
+    skip("Doesn't work with threaded perls",11)
+       if $Config{useithreads} || ($] < 5.009 && $Config{use5005threads});
 
     runlint 'implicit-read', '1 for @ARGV', <<'RESULT', 'implicit-read in foreach';
 Implicit use of $_ in foreach at -e line 1
@@ -80,4 +85,11 @@ RESULT
 Use of regexp variable $& at -e line 1
 RESULT
 
+    runlint 'bare-subs', 'sub bare(){1};$x=bare', '';
+
+    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
+
 }