In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fbe521465f3f73ca77e746257b5cd6411086e960?hp=88c8c9616516015e2fe0b502cdb92dc4efcc0c10>
- Log ----------------------------------------------------------------- commit fbe521465f3f73ca77e746257b5cd6411086e960 Author: Nicholas Clark <[email protected]> Date: Fri Feb 4 20:19:36 2011 +0000 Refactor B's o.t to use 'prog' and 'switches' with runperl(), not 'args'. Previously it was using an array to hold the list of command line arguments, between each test splicing the one element that actually changed, and then passing the array to runperl, without an explicit program. Not the clearest of approaches. ----------------------------------------------------------------------- Summary of changes: ext/B/t/o.t | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ext/B/t/o.t b/ext/B/t/o.t index f1c8ae3..75d8ee8 100644 --- a/ext/B/t/o.t +++ b/ext/B/t/o.t @@ -31,16 +31,14 @@ plan( 9 ); # And someone's responsible. # use() makes it difficult to avoid O::import() require_ok( 'O' ); -my @args = ('-Ilib', '-MO=success,foo,bar', '-e', '1' ); -my @lines = get_lines( @args ); +my @lines = get_lines( '-MO=success,foo,bar' ); is( $lines[0], 'Compiling!', 'Output should not be saved without -q switch' ); is( $lines[1], '(foo) <bar>', 'O.pm should call backend compile() method' ); is( $lines[2], '[]', 'Nothing should be in $O::BEGIN_output without -q' ); is( $lines[3], '-e syntax OK', 'O.pm should not munge perl output without -qq'); -$args[1] = '-MO=-q,success,foo,bar'; -@lines = get_lines( @args ); +@lines = get_lines( '-MO=-q,success,foo,bar' ); isnt( $lines[1], 'Compiling!', 'Output should not be printed with -q switch' ); SKIP: { @@ -48,18 +46,18 @@ SKIP: { unless $Config{useperlio}; is( $lines[1], "[Compiling!", '... but should be in $O::BEGIN_output' ); - $args[1] = '-MO=-qq,success,foo,bar'; - @lines = get_lines( @args ); + @lines = get_lines( '-MO=-qq,success,foo,bar' ); is( scalar @lines, 3, '-qq should suppress even the syntax OK message' ); } -$args[1] = '-MO=success,fail'; -@lines = get_lines( @args ); +@lines = get_lines( '-MO=success,fail' ); like( $lines[1], qr/fail at .eval/, 'O.pm should die if backend compile() does not return a subref' ); sub get_lines { - split(/[\r\n]+/, runperl( args => [ @_ ], stderr => 1 )); + my $compile = shift; + split(/[\r\n]+/, runperl( switches => [ '-Ilib', $compile ], + prog => 1, stderr => 1 )); } END { -- Perl5 Master Repository
