Test line breaks in PERL5DB
authorFather Chrysostomos <sprout@cpan.org>
Tue, 27 Aug 2013 20:20:39 +0000 (13:20 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 8 Sep 2013 21:39:02 +0000 (14:39 -0700)
$ PERL5DB='sub DB::DB{} die' perl5.18.1 -dle 'print "ok"'
Died.
$ PERL5DB='sub DB::DB{}
die' perl5.18.1 -dle 'print "ok"'
ok

So everything after the line break is ignored.

In bleadperl:

$ PERL5DB='sub DB::DB{} die' ./perl -dle 'print "ok"'
Died.
$ PERL5DB='sub DB::DB{}
die' ./perl -dle 'print "ok"'
Died at -e line 1.

Now the whole environment variable is used.  This was probably changed
by commit 2179133.

Let’s call it a bug fix and test it.

(The ‘at -e line 1’ is not right, but the next commit will fix it.)

t/run/switchd.t

index f160fd5..98acba4 100644 (file)
@@ -9,7 +9,7 @@ BEGIN { require "./test.pl"; }
 
 # This test depends on t/lib/Devel/switchd*.pm.
 
-plan(tests => 11);
+plan(tests => 12);
 
 my $r;
 
@@ -174,3 +174,17 @@ like(
                          # miniperl tacks a BEGIN block on to the same line
  'Copy on write does not mangle ${"_<-e"}[0] [perl #118627]',
 );
+
+# PERL5DB with embedded newlines
+{
+    local $ENV{PERL5DB} = "sub DB::DB{}\ndie";
+    like(
+      runperl(
+       switches => [ '-Ilib', '-ld' ],
+       prog     => 'print qq|not ok|',
+       stderr   => 1
+      ),
+      qr /Died/,
+     'PERL5DB with embedded newlines',
+    );
+}