Devel-DebugHooks
view release on metacpan or search on metacpan
t/29-cmd_l.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More 'no_plan';
use Test::Output;
use FindBin qw/ $Bin /; my $lib = "-I$Bin/lib -I$Bin/../lib";
use Data::Section::Simple qw/ get_data_section /;
use Test::Differences;
unified_diff();
{
no warnings qw/ redefine prototype /;
*is = \&eq_or_diff;
}
sub n {
$_ = join '', @_;
s#\t# #gm;
s#(?:[^\s]*?)?([^/]+\.p(?:m|l))#xxx/$1#gm;
s/x0:/ 0:/; #WORKAROUND: old perl shows zero line as breakable
$_;
}
sub nl {
$_ = n( @_ );
s#(xxx/.*?pm:)\d+#$1XXXX#gm;
$_;
}
my $cmds;
my $script;
my $files = get_data_section();
($script = <<'PERL') =~ s#^\t##gm;
sub t {
2;
}
1;
t();
PERL
is
n( `$^X $lib -d:DbInteract='list.conf;b 2;a 2 1;s 2;l .;q' -e '$script'` )
,$files->{ 'list' }
,"List the source code at current position";
($script = <<'PERL') =~ s#^\t##gm;
sub t0 {
1;
}
sub t1 {
t0();
}
sub t2 {
( run in 0.828 second using v1.01-cache-2.11-cpan-6aa56a78535 )