Skip to content

Commit

Permalink
Bug in transforming "set autoeval off" to "set auto eval off".
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocky Bernstein committed Dec 31, 2012
1 parent 3317edb commit cd87fea
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 43 deletions.
39 changes: 21 additions & 18 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
Artistic
bin/trepan.pl
Build.PL Proto Build creator
ChangeLog
Changes
GNUmakefile
MANIFEST This list of files
META.json
META.yml
Makefile.PL
README README in perlpod format for CPAN
README.md README in Markdown format for github
bin/trepan.pl
example/TCPPack.pm
example/action-bug.pl
example/eval.pl
example/except-bug1.pl
Expand All @@ -23,8 +15,10 @@ example/next2.pl
example/nexting.pl
example/our.pl
example/signal.pl
example/TCPPack.pm
example/test-module.pm
example/test-require.pl
GNUmakefile
gpl-2.0.txt
ignore.txt
lib/Devel/Trepan.pm
Expand Down Expand Up @@ -52,11 +46,11 @@ lib/Devel/Trepan/CmdProcessor/Command/Finish.pm
lib/Devel/Trepan/CmdProcessor/Command/Frame.pm
lib/Devel/Trepan/CmdProcessor/Command/Handle.pm
lib/Devel/Trepan/CmdProcessor/Command/Help.pm
lib/Devel/Trepan/CmdProcessor/Command/Help/README
lib/Devel/Trepan/CmdProcessor/Command/Help/command.pod
lib/Devel/Trepan/CmdProcessor/Command/Help/examples.pod
lib/Devel/Trepan/CmdProcessor/Command/Help/filename.pod
lib/Devel/Trepan/CmdProcessor/Command/Help/location.pod
lib/Devel/Trepan/CmdProcessor/Command/Help/README
lib/Devel/Trepan/CmdProcessor/Command/Help/suffixes.pod
lib/Devel/Trepan/CmdProcessor/Command/Info.pm
lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Breakpoints.pm
Expand Down Expand Up @@ -142,8 +136,8 @@ lib/Devel/Trepan/CmdProcessor/Command/Source.pm
lib/Devel/Trepan/CmdProcessor/Command/Step.pm
lib/Devel/Trepan/CmdProcessor/Command/Subcmd/Core.pm
lib/Devel/Trepan/CmdProcessor/Command/Subcmd/SubMgr.pm
lib/Devel/Trepan/CmdProcessor/Command/Subcmd/SubsubMgr.pm
lib/Devel/Trepan/CmdProcessor/Command/Subcmd/Subsubcmd.pm
lib/Devel/Trepan/CmdProcessor/Command/Subcmd/SubsubMgr.pm
lib/Devel/Trepan/CmdProcessor/Command/TBreak.pm
lib/Devel/Trepan/CmdProcessor/Command/Unalias.pm
lib/Devel/Trepan/CmdProcessor/Command/Undisplay.pm
Expand All @@ -170,6 +164,12 @@ lib/Devel/Trepan/DB/Display.pm
lib/Devel/Trepan/DB/Eval.pm
lib/Devel/Trepan/DB/LineCache.pm
lib/Devel/Trepan/DB/Sub.pm
lib/Devel/Trepan/Interface.pm
lib/Devel/Trepan/Interface/Client.pm
lib/Devel/Trepan/Interface/ComCodes.pm
lib/Devel/Trepan/Interface/Script.pm
lib/Devel/Trepan/Interface/Server.pm
lib/Devel/Trepan/Interface/User.pm
lib/Devel/Trepan/IO.pm
lib/Devel/Trepan/IO/InOutBase.pm
lib/Devel/Trepan/IO/Input.pm
Expand All @@ -179,12 +179,6 @@ lib/Devel/Trepan/IO/StringArray.pm
lib/Devel/Trepan/IO/TCPClient.pm
lib/Devel/Trepan/IO/TCPPack.pm
lib/Devel/Trepan/IO/TCPServer.pm
lib/Devel/Trepan/Interface.pm
lib/Devel/Trepan/Interface/Client.pm
lib/Devel/Trepan/Interface/ComCodes.pm
lib/Devel/Trepan/Interface/Script.pm
lib/Devel/Trepan/Interface/Server.pm
lib/Devel/Trepan/Interface/User.pm
lib/Devel/Trepan/Options.pm
lib/Devel/Trepan/Pod2Text.pm
lib/Devel/Trepan/Position.pm
Expand All @@ -196,6 +190,11 @@ lib/Devel/Trepan/Terminated.pm
lib/Devel/Trepan/Util.pm
lib/Devel/Trepan/Version.pm
lib/Devel/Trepan/WatchMgr.pm
MANIFEST This list of files
META.json
META.yml
README README in perlpod format for CPAN
README.md README in Markdown format for github
t/00test-pod.t
t/10test-brkptmgr.t
t/10test-cmd-complete.t Note: t/10*.t tests are unit tests
Expand Down Expand Up @@ -227,6 +226,7 @@ t/10test-watchmgr.t
t/20test-__FILE__.t
t/20test-action.t
t/20test-alias.t Note: t/20*.t tests are integration tests
t/20test-autoeval.t
t/20test-autolist.t
t/20test-break.t
t/20test-cont.t
Expand All @@ -251,13 +251,15 @@ t/20test-step.t
t/20test-trace.t
t/20test-trepanpl-opts.t
t/20test-watch1.t
t/Helper.pm Helper routine for integration tests
t/data/__FILE__.cmd
t/data/__FILE__.right
t/data/action.cmd
t/data/action.right
t/data/alias.cmd
t/data/alias.right
t/data/autoeval.cmd
t/data/autoeval.got
t/data/autoeval.right
t/data/autolist.cmd
t/data/autolist.right
t/data/break.cmd
Expand Down Expand Up @@ -320,3 +322,4 @@ t/data/watch1.cmd
t/data/watch1.right
t/data/watch2.cmd
t/data/watch2.right
t/Helper.pm Helper routine for integration tests
2 changes: 1 addition & 1 deletion lib/Devel/Trepan/CmdProcessor/Command/Set.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sub run($$)
if (scalar @$args > 1) {
$first = lc $args->[1];
my $alen = length('auto');
splice(@$args, 1, 2, ('auto', substr($first, $alen))) if
splice(@$args, 1, 1, ('auto', substr($first, $alen))) if
index($first, 'auto') == 0 && length($first) > $alen;
}
$self->SUPER::run($args);
Expand Down
2 changes: 1 addition & 1 deletion lib/Devel/Trepan/CmdProcessor/Command/Show.pm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sub run($$)
if (scalar @$args > 1) {
$first = lc $args->[1];
my $alen = length('auto');
splice(@$args, 1, 2, ('auto', substr($first, $alen))) if
splice(@$args, 1, 1, ('auto', substr($first, $alen))) if
index($first, 'auto') == 0 && length($first) > $alen;
}
$self->SUPER::run($args);
Expand Down
2 changes: 1 addition & 1 deletion t/20test-__FILE__.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ my $opts = {
};

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file(), undef, $opts);
run_debugger("$test_prog 3 5", undef, undef, $opts);
done_testing();
2 changes: 1 addition & 1 deletion t/20test-action.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ if ($OSNAME eq 'MSWin32') {

my $test_prog = File::Spec->catfile(dirname(__FILE__),
qw(.. example action-bug.pl));
run_debugger("$test_prog", cmd_file());
run_debugger("$test_prog");
done_testing();
2 changes: 1 addition & 1 deletion t/20test-alias.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use warnings; use strict;
use rlib '.'; use Helper;

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file());
run_debugger("$test_prog 3 5");
done_testing();
9 changes: 9 additions & 0 deletions t/20test-autoeval.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env perl
use warnings; use strict; use English qw( -no_match_vars );
use Test::More;
use Config;

use rlib '.'; use Helper;
my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5");
done_testing();
2 changes: 1 addition & 1 deletion t/20test-autolist.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ if (($OSNAME eq 'netbsd' or $OSNAME eq 'freebsd' or $OSNAME eq 'darwin')

use rlib '.'; use Helper;
my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", 'autolist.cmd');
run_debugger("$test_prog 3 5");
done_testing();
2 changes: 1 addition & 1 deletion t/20test-debug.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ my $opts = {
run_opts => " --no-highlight --basename -nx"
};

run_debugger("$test_prog 3 5", cmd_file(), undef, $opts);
run_debugger("$test_prog 3 5", undef, undef, $opts);
done_testing();
2 changes: 1 addition & 1 deletion t/20test-display.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use warnings; use strict;
use rlib '.'; use Helper;

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file());
run_debugger("$test_prog 3 5");
done_testing();
2 changes: 1 addition & 1 deletion t/20test-dollar0.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ my $opts = {
};

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file(), undef, $opts);
run_debugger("$test_prog 3 5", undef, undef, $opts);
done_testing();
2 changes: 1 addition & 1 deletion t/20test-eval.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ my $opts = {
run_opts => " --no-highlight --basename -nx --fall-off-end"
};

run_debugger("$test_prog 3 5", cmd_file(), undef, $opts);
run_debugger("$test_prog 3 5", undef, undef, $opts);
$test_prog = prog_file('eval.pl');

$opts = {
Expand Down
2 changes: 1 addition & 1 deletion t/20test-fin.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rlib '.'; use Helper;
no warnings 'redefine';

my $test_prog = prog_file('TCPPack.pm');
run_debugger("$test_prog", cmd_file());
run_debugger("$test_prog");

$test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", 'fin2.cmd');
Expand Down
2 changes: 1 addition & 1 deletion t/20test-help.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ my $opts = {
};

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file(), undef, $opts);
run_debugger("$test_prog 3 5", undef, undef, $opts);
done_testing();
2 changes: 1 addition & 1 deletion t/20test-line.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ my $opts = {
};

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file(), undef, $opts);
run_debugger("$test_prog 3 5", undef, undef, $opts);
done_testing();
2 changes: 1 addition & 1 deletion t/20test-next.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use warnings; use strict;
use rlib '.'; use Helper;

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file());
run_debugger("$test_prog 3 5");
done_testing();
3 changes: 1 addition & 2 deletions t/20test-opt-e.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ my $opts = {
run_opts => ' --basename --no-highlight -nx'
};

run_debugger("-e 'no warnings \"once\";\$x=1; \$y=2'", cmd_file(),
undef, $opts);
run_debugger("-e 'no warnings \"once\";\$x=1; \$y=2'", undef, undef, $opts);
done_testing();
2 changes: 1 addition & 1 deletion t/20test-seq1.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use warnings; use strict;
use rlib '.'; use Helper;

my $test_prog = prog_file('gcd.pl');
run_debugger("$test_prog 3 5", cmd_file());
run_debugger("$test_prog 3 5");
done_testing();
21 changes: 13 additions & 8 deletions t/Helper.pm
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
use warnings; use strict;
use Test::More;
use File::Spec;
use File::Basename;
my $trepanpl = File::Spec->catfile(dirname(__FILE__), qw(.. bin trepan.pl));
my $debug = $^W;
use File::Basename qw(dirname basename); use File::Spec;

package Helper;
use File::Basename qw(dirname); use File::Spec;
use English qw( -no_match_vars ) ;
use Config;
use File::Basename qw(dirname basename); use File::Spec;
require Exporter;
our (@ISA, @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(cmd_file prog_file run_debugger);

my $trepanpl = File::Spec->catfile(dirname(__FILE__), qw(.. bin trepan.pl));
my $debug = $^W;

# Return the natural command file assocated with a test.
# For file /a/b/t/20test-foo.t it is foo.cmd
sub cmd_file()
sub cmd_file(;$)
{
my ($pkg, $filename) = caller;
my ($level) = @_;
$level = 0 unless $level;
my ($pkg, $filename) = caller($level);
$filename =~ s/^.*20test-(.+)\.t$/$1/;
return $filename . '.cmd';
}
Expand All @@ -43,11 +45,14 @@ sub prog_file(;$)

# Runs debugger in subshell. 0 is returned if everything went okay.
# nonzero if something went wrong.
sub run_debugger($$;$$)
sub run_debugger($;$$$)
{
my ($test_invoke, $cmd_filename, $right_filename, $opts) = @_;
$opts = {} unless defined $opts;
$opts->{do_test} = 1 unless exists $opts->{do_test};
unless ($cmd_filename) {
$cmd_filename = cmd_file(1);
}
Test::More::note( "running $test_invoke with $cmd_filename" );
my $run_opts = $opts->{run_opts} ||
'--basename --nx --no-highlight --fall-off-end';
Expand Down
12 changes: 12 additions & 0 deletions t/data/autoeval.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Test "set auto list"
set basename on
set highlight off
set autoeval off
show autoeval
fdafdsa
1+2
set autoeval on
3+4
show autoeval
show auto eval
quit!
14 changes: 14 additions & 0 deletions t/data/autoeval.right
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- main::(gcd.pl:18)
die sprintf "Need two integer arguments, got %d", scalar(@ARGV) unless
@ARGV == 2;
basename is on.
highlight is off.
set auto eval is off.
Evaluation of unrecognized debugger commands is off.
*** Undefined command: "fdafdsa". Try "help".
*** Undefined command: "1+2". Try "help".
set auto eval is on.
$DB::D[0] = 7
Evaluation of unrecognized debugger commands is on.
Evaluation of unrecognized debugger commands is on.
trepan.pl: That's all, folks...

0 comments on commit cd87fea

Please sign in to comment.