Add a test for the source command.
authorShlomi Fish <shlomif@shlomifish.org>
Thu, 13 Sep 2012 13:52:54 +0000 (16:52 +0300)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:22 +0000 (09:18 -0500)
MANIFEST
lib/perl5db.t
lib/perl5db/t/source-cmd-test.perldb [new file with mode: 0644]

index f99c703..ff83e24 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4332,6 +4332,7 @@ lib/perl5db/t/proxy-constants     Tests for the Perl debugger
 lib/perl5db/t/rt-104168                Tests for the Perl debugger
 lib/perl5db/t/rt-61222         Tests for the Perl debugger
 lib/perl5db/t/rt-66110         Tests for the Perl debugger
+lib/perl5db/t/source-cmd-test.perldb           TTests for the Perl debugger
 lib/perl5db/t/symbol-table-bug Tests for the Perl debugger
 lib/perl5db/t/taint            Tests for the Perl debugger
 lib/perl5db/t/test-l-statement-1       Tests for the Perl debugger
index 5b60c54..a9d49d6 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(79);
+plan(80);
 
 my $rc_filename = '.perldb';
 
@@ -1903,6 +1903,38 @@ sub _calc_trace_wrapper
     );
 }
 
+# Test the 'source' command.
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                'source ../lib/perl5db/t/source-cmd-test.perldb',
+                # If we have a 'q' here, then the typeahead will override the
+                # input, and so it won't be reached - solution:
+                # put a q inside the .perldb commands.
+                # ( This may be a bug or a misfeature. )
+            ],
+            prog => '../lib/perl5db/t/disable-breakpoints-1',
+        }
+    );
+
+    $wrapper->contents_like(qr#
+        ^3:\s+my\ \$dummy\ =\ 0;\n
+        4\s*\n
+        5:\s+\$x\ =\ "FirstVal";\n
+        6\s*\n
+        7:\s+\$dummy\+\+;\n
+        8\s*\n
+        9:\s+\$x\ =\ "SecondVal";\n
+        10\s*\n
+        #msx,
+        'Test the source command (along with l)',
+    );
+
+    print $wrapper->get_output(), "\n";
+}
+
 END {
     1 while unlink ($rc_filename, $out_fn);
 }
diff --git a/lib/perl5db/t/source-cmd-test.perldb b/lib/perl5db/t/source-cmd-test.perldb
new file mode 100644 (file)
index 0000000..41a7365
--- /dev/null
@@ -0,0 +1,2 @@
+l 3-10
+q