This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert a test to DebugWrap.
authorShlomi Fish <shlomif@shlomifish.org>
Wed, 12 Sep 2012 13:08:16 +0000 (16:08 +0300)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:21 +0000 (09:18 -0500)
lib/perl5db.t

index b48b191..94a923e 100644 (file)
@@ -65,10 +65,7 @@ sub _out_contents
     return _slurp($out_fn);
 }
 
     return _slurp($out_fn);
 }
 
-
 {
 {
-    my $target = '../lib/perl5db/t/eval-line-bug';
-
     rc(
         <<"EOF",
     &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
     rc(
         <<"EOF",
     &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
@@ -84,17 +81,8 @@ sub _out_contents
     }
 EOF
     );
     }
 EOF
     );
-
-    {
-        local $ENV{PERLDB_OPTS} = "ReadLine=0";
-        runperl(switches => [ '-d' ], progfile => $target);
-    }
 }
 
 }
 
-like(_out_contents(), qr/new_var = <Foo>/,
-    "no strict 'vars' in evaluated lines.",
-);
-
 {
     local $ENV{PERLDB_OPTS} = "ReadLine=0";
     my $output = runperl(switches => [ '-d' ], progfile => '../lib/perl5db/t/lvalue-bug');
 {
     local $ENV{PERLDB_OPTS} = "ReadLine=0";
     my $output = runperl(switches => [ '-d' ], progfile => '../lib/perl5db/t/lvalue-bug');
@@ -405,6 +393,27 @@ package main;
     );
 }
 
     );
 }
 
+{
+    local $ENV{PERLDB_OPTS} = "ReadLine=0";
+    my $target = '../lib/perl5db/t/eval-line-bug';
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                'b 23',
+                'n',
+                '$new_var = "Foo"',
+                'x "new_var = <$new_var>\\n"',
+                'q',
+            ],
+            prog => $target,
+        }
+    );
+
+    $wrapper->contents_like( qr/new_var = <Foo>/,
+        "no strict 'vars' in evaluated lines.",
+    );
+}
 # Testing that we can set a line in the middle of the file.
 {
     my $wrapper = DebugWrap->new(
 # Testing that we can set a line in the middle of the file.
 {
     my $wrapper = DebugWrap->new(