pre{inc,dec} is faster, even with integers
[p5sagit/p5-mst-13.2.git] / t / run / switchd.t
CommitLineData
d7aa4417 1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = qw(../lib lib);
6}
7
8require "./test.pl";
9
10plan(tests => 1);
11
12my $r;
13my @tmpfiles = ();
14END { unlink @tmpfiles }
15
16my $filename = 'swdtest.tmp';
17SKIP: {
18 open my $f, ">$filename"
19 or skip( "Can't write temp file $filename: $!" );
20 print $f <<'__SWDTEST__';
21package Bar;
22sub bar { $_[0] * $_[0] }
23package Foo;
24sub foo {
25 my $s;
26 $s += Bar::bar($_) for 1..$_[0];
27}
28package main;
29Foo::foo(3);
30__SWDTEST__
31 close $f;
32 push @tmpfiles, $filename;
33 $| = 1; # Unbufferize.
34 $r = runperl(
54f45c29 35 switches => [ '-Ilib', '-d:switchd' ],
d7aa4417 36 progfile => $filename,
37 );
241416b8 38 like($r, qr/^main,swdtest.tmp,9;Foo,swdtest.tmp,5;Foo,swdtest.tmp,6;Foo,swdtest.tmp,6;Bar,swdtest.tmp,2;Bar,swdtest.tmp,2;Bar,swdtest.tmp,2;$/i);
d7aa4417 39}
40