SYN SYN
[p5sagit/p5-mst-13.2.git] / t / lib / dumper.t
index 3167535..be9732f 100755 (executable)
@@ -5,7 +5,12 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    unshift @INC, '../lib' if -d '../lib';
+    @INC = '../lib';
+    require Config; import Config;
+    if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
+      print "1..0 # Skip: Data::Dumper was not built\n";
+      exit 0;
+    }
 }
 
 use Data::Dumper;
@@ -257,11 +262,14 @@ EOT
 ##
 $WANT = <<'EOT';
 #$VAR1 = {
-#  "abc\0'\efg" => "mno\0"
+#  "abc\0'\efg" => "mno\0",
+#  "reftest" => \\1
 #};
 EOT
 
-$foo = { "abc\000\'\efg" => "mno\000" };
+$foo = { "abc\000\'\efg" => "mno\000",
+         "reftest" => \\1,
+       };
 {
   local $Data::Dumper::Useqq = 1;
   TEST q(Dumper($foo));
@@ -269,7 +277,8 @@ $foo = { "abc\000\'\efg" => "mno\000" };
 
   $WANT = <<"EOT";
 #\$VAR1 = {
-#  'abc\0\\'\efg' => 'mno\0'
+#  'abc\0\\'\efg' => 'mno\0',
+#  'reftest' => \\\\1
 #};
 EOT
 
@@ -287,7 +296,7 @@ EOT
   package main;
   use Data::Dumper;
   $foo = 5;
-  @foo = (10,\*foo);
+  @foo = (-10,\*foo);
   %foo = (a=>1,b=>\$foo,c=>\@foo);
   $foo{d} = \%foo;
   $foo[2] = \%foo;
@@ -299,7 +308,7 @@ EOT
 #*::foo = \5;
 #*::foo = [
 #           #0
-#           10,
+#           -10,
 #           #1
 #           do{my $o},
 #           #2
@@ -330,7 +339,7 @@ EOT
 #$foo = \*::foo;
 #*::foo = \5;
 #*::foo = [
-#  10,
+#  -10,
 #  do{my $o},
 #  {
 #    'a' => 1,
@@ -356,7 +365,7 @@ EOT
 ##
   $WANT = <<'EOT';
 #@bar = (
-#  10,
+#  -10,
 #  \*::foo,
 #  {}
 #);
@@ -383,7 +392,7 @@ EOT
 ##
   $WANT = <<'EOT';
 #$bar = [
-#  10,
+#  -10,
 #  \*::foo,
 #  {}
 #];
@@ -411,7 +420,7 @@ EOT
   $WANT = <<'EOT';
 #$foo = \*::foo;
 #@bar = (
-#  10,
+#  -10,
 #  $foo,
 #  {
 #    a => 1,
@@ -433,7 +442,7 @@ EOT
   $WANT = <<'EOT';
 #$foo = \*::foo;
 #$bar = [
-#  10,
+#  -10,
 #  $foo,
 #  {
 #    a => 1,