summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--t/run/switchd-78586.t40
2 files changed, 41 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index 1ea8e21f8c..9c4fe13eba 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4841,6 +4841,7 @@ t/run/script.t See if script invocation works
t/run/switch0.t Test the -0 switch
t/run/switcha.t Test the -a switch
t/run/switchC.t Test the -C switch
+t/run/switchd-78586.t See whether bug 78586 is fixed
t/run/switchd.t Test the -d switch
t/run/switches.t Tests for the other switches (-0, -l, -c, -s, -M, -m, -V, -v, -h, -z, -i)
t/run/switchF1.t Pathological tests for the -F switch
diff --git a/t/run/switchd-78586.t b/t/run/switchd-78586.t
new file mode 100644
index 0000000000..6dbf045e80
--- /dev/null
+++ b/t/run/switchd-78586.t
@@ -0,0 +1,40 @@
+#!perl -Ilib -d:switchd_empty
+
+BEGIN { $^P = 0x122; chdir 't'; require './test.pl'; }
+use strict;
+use warnings;
+no warnings 'redefine';
+
+plan 2;
+
+our @lines;
+sub DB::DB {
+ my ($p, $f, $l) = caller;
+ return unless $f =~ /^\(eval \d+\)\[.*78586\.t:\d+\]/;
+ push @lines, $l;
+}
+
+sub trace_lines {
+ my ($src) = @_;
+ local @lines;
+ eval $src;
+ die if $@;
+ return join " ", @lines;
+}
+
+is trace_lines(<<'END'), "1 3 3 5";
+ ++$b;
+ {
+ ++$b;
+ }
+ ++$b;
+END
+
+is trace_lines(<<'END'), "1 2 3 3 5";
+ ++$b;
+ for (my $a=1; $a <= 2; ++$a) {
+ ++$b;
+ }
+ ++$b;
+END
+