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