From fc6b470a9b3c7b9e095c3bac75416cf4c5dca0d3 Mon Sep 17 00:00:00 2001 From: Tim Bunce Date: Thu, 11 Nov 2010 04:13:52 -0800 Subject: [PATCH] Test for [perl #78586] --- MANIFEST | 1 + t/run/switchd-78586.t | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 t/run/switchd-78586.t diff --git a/MANIFEST b/MANIFEST index 1ea8e21..9c4fe13 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 0000000..6dbf045 --- /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 + -- 2.7.4