package Devel::switchd;
use strict; BEGIN { } # use strict; BEGIN { ... } to incite [perl #21890]
+sub import { print "import<@_>;" }
package DB;
-sub DB { print join(",", caller), ";" }
+sub DB { print "DB<", join(",", caller), ">;" }
+sub sub { print "sub<$DB::sub>;"; goto &$DB::sub }
1;
require "./test.pl";
-plan(tests => 1);
+# This test depends on t/lib/Devel/switchd.pm.
+
+plan(tests => 2);
my $r;
my @tmpfiles = ();
$r = runperl(
switches => [ '-Ilib', '-d:switchd' ],
progfile => $filename,
+ args => ['3'],
+ );
+ 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>;$/);
+ $r = runperl(
+ switches => [ '-Ilib', '-d:switchd=a,42' ],
+ progfile => $filename,
+ args => ['4'],
);
- 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);
+ 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>;$/);
}