10 # This test depends on t/lib/Devel/switchd.pm.
16 END { unlink @tmpfiles }
18 my $filename = 'swdtest.tmp';
20 open my $f, ">$filename"
21 or skip( "Can't write temp file $filename: $!" );
22 print $f <<'__SWDTEST__';
24 sub bar { $_[0] * $_[0] }
28 $s += Bar::bar($_) for 1..$_[0];
34 push @tmpfiles, $filename;
35 $| = 1; # Unbufferize.
37 switches => [ '-Ilib', '-d:switchd' ],
38 progfile => $filename,
41 like($r, qr/^sub<Devel::switchd::import>;import<Devel::switchd>;DB<main,swdtest.tmp,9>;sub<Foo::foo>;DB<Foo,swdtest.tmp,5>;DB<Foo,swdtest.tmp,6>;DB<Foo,swdtest.tmp,6>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;$/);
43 switches => [ '-Ilib', '-d:switchd=a,42' ],
44 progfile => $filename,
47 like($r, qr/^sub<Devel::switchd::import>;import<Devel::switchd a 42>;DB<main,swdtest.tmp,9>;sub<Foo::foo>;DB<Foo,swdtest.tmp,5>;DB<Foo,swdtest.tmp,6>;DB<Foo,swdtest.tmp,6>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;$/);