2 # Copyright (C) 2007, Parrot Foundation.
9 use Test::More tests => 14;
12 use_ok('config::init::defaults');
13 use_ok('config::init::install');
14 use Parrot::Configure;
15 use Parrot::Configure::Options qw( process_options );
16 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 use Parrot::Configure::Step::List qw( get_steps_list );
20 is( $|, 1, "output autoflush is set" );
22 my $testopt = q{bindir};
23 my $testoptval = q{mybindir};
24 my $localargv = [ qq{--$testopt=$testoptval}, ];
25 my ($args, $step_list_ref) = process_options(
31 ok( defined $args, "process_options returned successfully" );
33 my $conf = Parrot::Configure->new;
35 test_step_thru_runstep( $conf, q{init::defaults}, $args );
37 my ( $task, $step_name, $step, $ret );
38 my $pkg = q{init::install};
40 $conf->add_steps($pkg);
41 $conf->options->set( %{$args} );
43 $task = $conf->steps->[1];
44 $step_name = $task->step;
46 $step = $step_name->new();
47 ok( defined $step, "$step_name constructor returned defined value" );
48 isa_ok( $step, $step_name );
49 ok( $step->description(), "$step_name has description" );
51 is( $conf->options->{c}->{$testopt},
52 $testoptval, "command-line option '--$testopt' has been stored in object" );
54 my $val = $conf->option_or_data($testopt);
55 is( $val, $testoptval, 'option_or_data() returned expected value' );
57 pass("Completed all tests in $0");
59 ################### DOCUMENTATION ###################
63 029-option_or_data.t - test C<Parrot::Configure::option_or_data()>
67 % prove t/configure/029-option_or_data.t
71 The files in this directory test functionality used by F<Configure.pl>.
73 This file tests C<Parrot::Configure::option_or_data()> in the case where
74 a value for the tested option has been set on the command line and a
75 value for the tested option has been located internally by a
84 Parrot::Configure, F<Configure.pl>.
90 # cperl-indent-level: 4
93 # vim: expandtab shiftwidth=4: