Author: jkeenan
Date: Sun Aug 10 12:29:13 2008
New Revision: 30157
Added:
branches/stepdescription/t/configure/056-verbose_step.t
- copied, changed from r30156,
/branches/stepdescription/t/configure/055-verbose_step.t
branches/stepdescription/t/configure/testlib/init/mu.pm
- copied, changed from r30156,
/branches/stepdescription/t/configure/testlib/init/iota.pm
Modified:
branches/stepdescription/lib/Parrot/Configure.pm
Log:
Add test file and dummy copy file to demonstrate that --verbose-step does the
right thing while running a configuration step not named in --verbose-step.
Modified: branches/stepdescription/lib/Parrot/Configure.pm
==============================================================================
--- branches/stepdescription/lib/Parrot/Configure.pm (original)
+++ branches/stepdescription/lib/Parrot/Configure.pm Sun Aug 10 12:29:13 2008
@@ -258,9 +258,9 @@
}
}
if ( scalar keys %verbose_steps ) {
- if ( $verbose_steps{$step_name} ) {
- $this_step_is_verbose = $step_name;
- }
+ $this_step_is_verbose = $verbose_steps{$step_name}
+ ? $step_name
+ : q{};
}
$n++;
@@ -268,7 +268,7 @@
{
task => $task,
verbose => $verbose,
- verbose_step => $this_step_is_verbose || q{},
+ verbose_step => $this_step_is_verbose,
ask => $ask,
n => $n,
silent => $silent,
@@ -387,6 +387,7 @@
# set per step verbosity
if ( $args->{verbose_step} ) {
+print STDERR "Going verbose\n";
$conf->options->set( verbose => 2 );
}
Copied: branches/stepdescription/t/configure/056-verbose_step.t (from r30156,
/branches/stepdescription/t/configure/055-verbose_step.t)
==============================================================================
--- /branches/stepdescription/t/configure/055-verbose_step.t (original)
+++ branches/stepdescription/t/configure/056-verbose_step.t Sun Aug 10
12:29:13 2008
@@ -1,12 +1,12 @@
#! perl
# Copyright (C) 2007, The Perl Foundation.
# $Id$
-# 055-verbose_step.t
+# 056-verbose_step.t
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More tests => 12;
use Carp;
use lib qw( lib t/configure/testlib );
use Parrot::Configure;
@@ -18,7 +18,7 @@
my $args = process_options(
{
- argv => [q{--verbose-step=alpha::beta,init::manifest}],
+ argv => [q{--verbose-step=init::alpha}],
mode => q{configure},
}
);
@@ -28,8 +28,8 @@
my $conf = Parrot::Configure->new;
ok( defined $conf, "Parrot::Configure->new() returned okay" );
-my $step = q{init::beta};
-my $description = 'Determining if your computer does beta';
+my $step = q{init::mu};
+my $description = 'Determining if your computer does mu';
$conf->add_steps($step);
my @confsteps = @{ $conf->steps };
@@ -49,11 +49,14 @@
is( $conf->options->{c}->{debugging},
1, "command-line option '--debugging' has been stored in object" );
-eval { $conf->runsteps(); };
-like($@,
- qr/Argument to 'verbose-step' option must be comma-delimited string of
valid configuration steps/,
- "Got expected error message for bad value to --verbose-step"
-);
+{
+ my $rv;
+ my ($stdout, $stderr);
+ capture ( sub {$rv = $conf->runsteps}, \$stdout, \$stderr );
+ ok( $rv, "runsteps successfully ran $step" );
+ like($stdout, qr/^\s*init::mu.*done\.\s*$/s,
+ "As expected, description is only standard output");
+}
pass("Completed all tests in $0");
@@ -61,18 +64,19 @@
=head1 NAME
-055-verbose_step.t - test bad step failure case in Parrot::Configure
+056-verbose_step.t - test bad step failure case in Parrot::Configure
=head1 SYNOPSIS
- % prove t/configure/055-verbose_step.t
+ % prove t/configure/056-verbose_step.t
=head1 DESCRIPTION
The files in this directory test functionality used by F<Configure.pl>.
The tests in this file examine what happens when you configure with the
-<--verbose-step> option and provide a bad value.
+<--verbose-step> option and provide a value for a step other than the step
+currently running.
=head1 AUTHOR
Copied: branches/stepdescription/t/configure/testlib/init/mu.pm (from r30156,
/branches/stepdescription/t/configure/testlib/init/iota.pm)
==============================================================================
--- /branches/stepdescription/t/configure/testlib/init/iota.pm (original)
+++ branches/stepdescription/t/configure/testlib/init/mu.pm Sun Aug 10
12:29:13 2008
@@ -3,11 +3,11 @@
=head1 NAME
-t/configure/testlib/init/iota.pm - Module used in configuration tests
+t/configure/testlib/init/mu.pm - Module used in configuration tests
=cut
-package init::iota;
+package init::mu;
use strict;
use warnings;
@@ -16,7 +16,7 @@
sub _init {
my $self = shift;
my %data;
- $data{description} = q{Determining if your computer does iota};
+ $data{description} = q{Determining if your computer does mu};
$data{args} = [ qw( ) ];
$data{result} = q{};
return \%data;
@@ -26,8 +26,7 @@
sub runstep {
my ( $self, $conf ) = @_;
- $self->set_result($result);
- return;
+ return 1;
}
1;