Skip tests that require Data::Dumper if it is not built
[p5sagit/p5-mst-13.2.git] / ext / B / t / optree_specials.t
index bceda7c..b9eec16 100644 (file)
@@ -3,6 +3,17 @@
 BEGIN {
     chdir 't';
     @INC = ('../lib', '../ext/B/t');
+    require Config;
+    if (($Config::Config{'extensions'} !~ /\bB\b/) ){
+        print "1..0 # Skip -- Perl configured without B module\n";
+        exit 0;
+    }
+    if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
+       print
+           "1..0 # Skip: Data::Dumper was not built, needed by OptreeCheck\n";
+       exit 0;
+
+    }
     require './test.pl';
 }
 
@@ -21,13 +32,7 @@ my $out = runperl(
 
 #print "out:$out\n";
 
-my $src = q{
-    our ($beg, $chk, $init, $end) = "'foo'";
-    BEGIN { $beg++ }
-    CHECK { $chk++ }
-    INIT  { $init++ }
-    END   { $end++ }
-};
+my $src = q[our ($beg, $chk, $init, $end) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ }];