From b16615d5eb1cbc72aff3e72a35b2e3bd4ed5f34f Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 12 Sep 2012 17:01:16 +0300 Subject: [PATCH] Convert another test to DebugWrap. --- lib/perl5db.t | 50 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/lib/perl5db.t b/lib/perl5db.t index 017e54f..6efb74e 100644 --- a/lib/perl5db.t +++ b/lib/perl5db.t @@ -85,16 +85,6 @@ EOF SKIP: { if ( $Config{usethreads} ) { - skip('This perl has threads, skipping non-threaded debugger tests'); - } else { - my $error = 'This Perl not built to support threads'; - my $output = runperl( switches => [ '-dt' ], stderr => 1 ); - like($output, qr/$error/, 'Perl debugger correctly complains that it was not built with threads'); - } - -} -SKIP: { - if ( $Config{usethreads} ) { local $ENV{PERLDB_OPTS} = "ReadLine=0 NonStop=1"; my $output = runperl(switches => [ '-dt' ], progfile => '../lib/perl5db/t/symbol-table-bug'); like($output, qr/Undefined symbols 0/, 'there are no undefined values in the symbol table when running with thread support'); @@ -262,6 +252,19 @@ sub field return $self->{field}; } + +sub _switches +{ + my $self = shift; + + if (@_) + { + $self->{_switches} = shift; + } + + return $self->{_switches}; +} + sub _contents { my $self = shift; @@ -298,6 +301,11 @@ sub _init $self->_stderr_val(exists($args->{stderr}) ? $args->{stderr} : 1); + if (exists($args->{switches})) + { + $self->_switches($args->{switches}); + } + $self->_run(); return; @@ -337,7 +345,7 @@ sub _run { ::runperl( switches => [ - '-d', + ($self->_switches ? (@{$self->_switches()}) : ('-d')), ($self->_include_t ? ('-I', '../lib/perl5db/t') : ()) ], (defined($self->_stderr_val()) @@ -465,6 +473,26 @@ sub calc_new_var_wrapper ); } +SKIP: +{ + if ( $Config{usethreads} ) { + skip('This perl has threads, skipping non-threaded debugger tests'); + } + else { + my $error = 'This Perl not built to support threads'; + calc_new_var_wrapper( + { + prog => '../lib/perl5db/t/eval-line-bug', + switches => ['-dt',], + stderr => 1, + } + )->output_like( + qr/\Q$error\E/, + 'Perl debugger correctly complains that it was not built with threads', + ); + } +} + # Testing that we can set a line in the middle of the file. { my $wrapper = DebugWrap->new( -- 2.7.4