Author: jkeenan Date: Sat Sep 1 08:10:13 2007 New Revision: 20991 Modified: branches/optiondata/t/configure/027-option_or_data.t branches/optiondata/t/configure/028-option_or_data.t branches/optiondata/t/configure/029-option_or_data.t branches/optiondata/t/configure/030-option_or_data.t
Log: Revamp 4 test files to test option_or_data() more simply. Modified: branches/optiondata/t/configure/027-option_or_data.t ============================================================================== --- branches/optiondata/t/configure/027-option_or_data.t (original) +++ branches/optiondata/t/configure/027-option_or_data.t Sat Sep 1 08:10:13 2007 @@ -18,9 +18,10 @@ $| = 1; is($|, 1, "output autoflush is set"); -my $CC = "/usr/bin/gcc-3.3"; +my $testopt = q{bindir}; +my $testoptval = q{mybindir}; my $localargv = [ - qq{--cc=$CC}, + qq{--$testopt=$testoptval}, ]; my $args = process_options( { mode => q{configure}, @@ -36,11 +37,11 @@ $conf->add_steps(get_steps_list()); $conf->options->set(%args); -is($conf->options->{c}->{cc}, $CC, - "command-line option '--cc' has been stored in object"); +is($conf->options->{c}->{$testopt}, $testoptval, + "command-line option '--$testopt' has been stored in object"); -my $val = $conf->option_or_data('cc'); -is($val, $CC, 'option_or_data() returned expected value'); +my $val = $conf->option_or_data($testopt); +is($val, $testoptval, 'option_or_data() returned expected value'); pass("Completed all tests in $0"); @@ -58,7 +59,10 @@ The files in this directory test functionality used by F<Configure.pl>. -This file tests C<Parrot::Configure::option_or_data()>. +This file tests C<Parrot::Configure::option_or_data()> in the case where +a value for the tested option has been set on the command line but +where no value for the tested option has been located internally by a +configuration step. =head1 AUTHOR Modified: branches/optiondata/t/configure/028-option_or_data.t ============================================================================== --- branches/optiondata/t/configure/028-option_or_data.t (original) +++ branches/optiondata/t/configure/028-option_or_data.t Sat Sep 1 08:10:13 2007 @@ -6,13 +6,11 @@ use strict; use warnings; -use Test::More tests => 25; +use Test::More tests => 15; use Carp; use lib qw( lib ); use_ok('config::init::defaults'); use_ok('config::init::install'); -use_ok('config::init::hints'); -use_ok('config::inter::progs'); use Parrot::Configure; use Parrot::Configure::Options qw( process_options ); use Parrot::Configure::Test qw( test_step_thru_runstep); @@ -23,6 +21,8 @@ $| = 1; is($|, 1, "output autoflush is set"); +my $testopt = q{bindir}; +my $testoptval = q{mybindir}; my $localargv = [ ]; my $args = process_options( { mode => q{configure}, @@ -33,16 +33,14 @@ my $conf = Parrot::Configure->new; test_step_thru_runstep($conf, q{init::defaults}, $args); -test_step_thru_runstep($conf, q{init::install}, $args); -test_step_thru_runstep($conf, q{init::hints}, $args); my ($task, $step_name, @step_params, $step, $ret); -my $pkg = q{inter::progs}; +my $pkg = q{init::install}; $conf->add_steps($pkg); $conf->options->set(%{$args}); -$task = $conf->steps->[3]; +$task = $conf->steps->[1]; $step_name = $task->step; @step_params = @{ $task->params }; @@ -53,9 +51,8 @@ $ret = $step->runstep($conf); ok(defined $ret, "$step_name runstep() returned defined value"); -my $arg = q{cc}; -my $val = $conf->option_or_data( $arg ); -is($val, $conf->data->get( $arg ), +my $val = $conf->option_or_data( $testopt ); +is($val, $conf->data->get( $testopt ), 'option_or_data() returned expected value when no option provided'); pass("Completed all tests in $0"); @@ -74,7 +71,10 @@ The files in this directory test functionality used by F<Configure.pl>. -This file tests C<Parrot::Configure::option_or_data()>. +This file tests C<Parrot::Configure::option_or_data()> in the case where +no value for the tested option has been set on the command line but a +value for the tested option has been located internally by a +configuration step. =head1 AUTHOR Modified: branches/optiondata/t/configure/029-option_or_data.t ============================================================================== --- branches/optiondata/t/configure/029-option_or_data.t (original) +++ branches/optiondata/t/configure/029-option_or_data.t Sat Sep 1 08:10:13 2007 @@ -6,13 +6,11 @@ use strict; use warnings; -use Test::More tests => 25; +use Test::More tests => 15; use Carp; use lib qw( lib ); use_ok('config::init::defaults'); use_ok('config::init::install'); -use_ok('config::init::hints'); -use_ok('config::inter::progs'); use Parrot::Configure; use Parrot::Configure::Options qw( process_options ); use Parrot::Configure::Test qw( test_step_thru_runstep); @@ -23,9 +21,10 @@ $| = 1; is($|, 1, "output autoflush is set"); -my $CC = "/usr/bin/gcc-3.3"; +my $testopt = q{bindir}; +my $testoptval = q{mybindir}; my $localargv = [ - qq{--cc=$CC}, + qq{--$testopt=$testoptval}, ]; my $args = process_options( { mode => q{configure}, @@ -36,16 +35,14 @@ my $conf = Parrot::Configure->new; test_step_thru_runstep($conf, q{init::defaults}, $args); -test_step_thru_runstep($conf, q{init::install}, $args); -test_step_thru_runstep($conf, q{init::hints}, $args); my ($task, $step_name, @step_params, $step, $ret); -my $pkg = q{inter::progs}; +my $pkg = q{init::install}; $conf->add_steps($pkg); $conf->options->set(%{$args}); -$task = $conf->steps->[3]; +$task = $conf->steps->[1]; $step_name = $task->step; @step_params = @{ $task->params }; @@ -53,14 +50,12 @@ ok(defined $step, "$step_name constructor returned defined value"); isa_ok($step, $step_name); ok($step->description(), "$step_name has description"); -$ret = $step->runstep($conf); -ok(defined $ret, "$step_name runstep() returned defined value"); -TODO: { - local $TODO = 'not working for all C compilers'; - my $val = $conf->option_or_data('cc'); - is($val, $CC, 'option_or_data() returned expected value'); -} +is($conf->options->{c}->{$testopt}, $testoptval, + "command-line option '--$testopt' has been stored in object"); + +my $val = $conf->option_or_data($testopt); +is($val, $testoptval, 'option_or_data() returned expected value'); pass("Completed all tests in $0"); @@ -78,7 +73,10 @@ The files in this directory test functionality used by F<Configure.pl>. -This file tests C<Parrot::Configure::option_or_data()>. +This file tests C<Parrot::Configure::option_or_data()> in the case where +a value for the tested option has been set on the command line and a +value for the tested option has been located internally by a +configuration step. =head1 AUTHOR Modified: branches/optiondata/t/configure/030-option_or_data.t ============================================================================== --- branches/optiondata/t/configure/030-option_or_data.t (original) +++ branches/optiondata/t/configure/030-option_or_data.t Sat Sep 1 08:10:13 2007 @@ -20,6 +20,8 @@ $| = 1; is($|, 1, "output autoflush is set"); +my $testopt = q{bindir}; +my $testoptval = q{mybindir}; my $localargv = [ ]; my $args = process_options( { mode => q{configure}, @@ -48,7 +50,7 @@ like($bigmsg, qr/$description/s, "Got message expected upon running $step"); -ok(! defined ($conf->option_or_data('cc') ), +ok(! defined ($conf->option_or_data($testopt) ), "option_or_data returned undef; neither option nor data had been defined"); pass("Completed all tests in $0"); @@ -67,7 +69,10 @@ The files in this directory test functionality used by F<Configure.pl>. -This file tests C<Parrot::Configure::option_or_data()>. +This file tests C<Parrot::Configure::option_or_data()> in the case where +no value for the tested option has been set on the command line but +where no value for the tested option has been located internally by a +configuration step. =head1 AUTHOR