Author: jkeenan
Date: Sat Apr 14 06:51:07 2007
New Revision: 18189
Modified:
branches/reconfigure/lib/Parrot/Configure.pm
branches/reconfigure/t/configure/03-steplist.t
branches/reconfigure/t/configure/04-configure.t
branches/reconfigure/t/configure/05-run_one_step.t
Log:
Minor cleanups, including use of $step rather than hard-coding
'init::manifest'.
Modified: branches/reconfigure/lib/Parrot/Configure.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Configure.pm (original)
+++ branches/reconfigure/lib/Parrot/Configure.pm Sat Apr 14 06:51:07 2007
@@ -215,7 +215,6 @@
$self->_runstep( $task, $verbose, $verbose_step, $ask, 1 );
}
}
- return 1;
}
sub _runstep {
Modified: branches/reconfigure/t/configure/03-steplist.t
==============================================================================
--- branches/reconfigure/t/configure/03-steplist.t (original)
+++ branches/reconfigure/t/configure/03-steplist.t Sat Apr 14 06:51:07 2007
@@ -19,7 +19,7 @@
}
unshift @INC, qq{$topdir/lib};
}
-use Test::More qw(no_plan); # tests => 10;
+use Test::More tests => 4;
use Carp;
use_ok('Parrot::Configure::Step::List', qw|
get_steps_list
Modified: branches/reconfigure/t/configure/04-configure.t
==============================================================================
--- branches/reconfigure/t/configure/04-configure.t (original)
+++ branches/reconfigure/t/configure/04-configure.t Sat Apr 14 06:51:07 2007
@@ -19,7 +19,7 @@
}
unshift @INC, qq{$topdir/lib};
}
-use Test::More qw(no_plan); # tests => 10;
+use Test::More tests => 30;
use Carp;
use Data::Dumper;
$Data::Dumper::Indent=1;
@@ -38,9 +38,11 @@
is($|, 1, "output autoflush is set");
my $CC = "/usr/bin/gcc-3.3";
-my $localargv = [ qq{--cc=$CC} ];
+my $localargv = [
+ qq{--cc=$CC},
+ qq{--step=init::manifest},
+];
my $args = process_options( {
-# argv => [ ],
argv => $localargv,
script => $0,
parrot_version => $parrot_version,
@@ -51,9 +53,12 @@
my $conf = Parrot::Configure->new;
ok(defined $conf, "Parrot::Configure->new() returned okay");
+# print STDERR Dumper $conf, "\n";
+isa_ok($conf, "Parrot::Configure");
my $newconf = Parrot::Configure->new;
ok(defined $newconf, "Parrot::Configure->new() returned okay");
+isa_ok($newconf, "Parrot::Configure");
is($conf, $newconf, "Parrot::Configure object is a singleton");
# Since these tests peek into the Parrot::Configure object, they will break if
@@ -70,6 +75,15 @@
isa_ok($conf->$k, "Parrot::Configure::Data");
}
+can_ok("Parrot::Configure", qw| data |);
+can_ok("Parrot::Configure", qw| options |);
+can_ok("Parrot::Configure", qw| steps |);
+can_ok("Parrot::Configure", qw| add_step |);
+can_ok("Parrot::Configure", qw| add_steps |);
+can_ok("Parrot::Configure", qw| runstep |);
+can_ok("Parrot::Configure", qw| runsteps |);
+can_ok("Parrot::Configure", qw| _runstep |);
+
$conf->add_steps(get_steps_list());
my @confsteps = @{$conf->steps};
isnt(scalar @confsteps, 0,
@@ -86,6 +100,10 @@
is($conf->options->{c}->{debugging}, 1,
"command-line option '--debugging' has been stored in object");
+eval { $conf->data()->slurp(); };
+like($@,
+ qr/You cannot use --step until you have completed the full configure
process/,
+ "Got expected error message when using --step option without prior
completed configuration");
pass("Completed all tests in $0");
@@ -105,6 +123,8 @@
The tests in this file test those Parrot::Configure methods regularly called
by F<Configure.pl> up to, but not including, C<Parrot::Configure::runsteps()>.
+There is also a test for failure of the C<--step> option without prior
+completed configuration.
=head1 AUTHOR
Modified: branches/reconfigure/t/configure/05-run_one_step.t
==============================================================================
--- branches/reconfigure/t/configure/05-run_one_step.t (original)
+++ branches/reconfigure/t/configure/05-run_one_step.t Sat Apr 14 06:51:07 2007
@@ -19,7 +19,7 @@
}
unshift @INC, qq{$topdir/lib};
}
-use Test::More tests => 20;
+use Test::More tests => 23;
use Carp;
#use Data::Dumper;
#$Data::Dumper::Indent=1;
@@ -38,7 +38,6 @@
$| = 1;
is($|, 1, "output autoflush is set");
-my $CC = "/usr/bin/gcc-3.3";
my $args = process_options( {
argv => [],
script => $0,
@@ -69,7 +68,11 @@
isa_ok($conf->$k, "Parrot::Configure::Data");
}
-$conf->add_steps( qw| init::manifest | );
+my $step = q{init::manifest};
+# Following assignment would change if config/init/manifest.pm changed.
+my $description = q{Checking MANIFEST};
+
+$conf->add_steps( $step );
my @confsteps = @{$conf->steps};
isnt(scalar @confsteps, 0,
"Parrot::Configure object 'steps' key holds non-empty array reference");
@@ -80,6 +83,12 @@
$nontaskcount++ unless $k->isa("Parrot::Configure::Task");
}
is($nontaskcount, 0, "Each step is a Parrot::Configure::Task object");
+is($confsteps[0]->step, $step,
+ "'step' element of Parrot::Configure::Task struct identified");
+is(ref($confsteps[0]->params), 'ARRAY',
+ "'params' element of Parrot::Configure::Task struct is array ref");
+ok(! ref($confsteps[0]->object),
+ "'object' element of Parrot::Configure::Task struct is not yet a ref");
$conf->options->set(%args);
is($conf->options->{c}->{debugging}, 1,
@@ -93,9 +102,9 @@
$rv = $conf->runsteps;
$msg = $tie->READLINE;
}
-ok($rv, "runsteps successfully ran init::manifest");
-like($msg, qr/Checking MANIFEST/,
- "Got message expected upon running init::manifest");
+ok($rv, "runsteps successfully ran $step");
+like($msg, qr/$description/,
+ "Got message expected upon running $step");
pass("Completed all tests in $0");