2 # Copyright (C) 2007, Parrot Foundation.
9 use Test::More tests => 13;
11 use lib qw( lib t/configure/testlib );
12 use Parrot::Configure;
13 use Parrot::Configure::Options qw( process_options );
14 use IO::CaptureOutput qw | capture |;
17 is($|, 1, "output autoflush is set");
19 my ($args, $step_list_ref) = process_options( {
23 ok(defined $args, "process_options returned successfully");
26 my $conf = Parrot::Configure->new;
27 ok(defined $conf, "Parrot::Configure->new() returned okay");
29 my $step = q{init::zeta};
30 my $description = 'Determining if your computer does zeta';
32 $conf->add_steps( $step );
33 my @confsteps = @{$conf->steps};
34 isnt(scalar @confsteps, 0,
35 "Parrot::Configure object 'steps' key holds non-empty array reference");
36 is(scalar @confsteps, 1,
37 "Parrot::Configure object 'steps' key holds ref to 1-element array");
39 foreach my $k (@confsteps) {
40 $nontaskcount++ unless $k->isa("Parrot::Configure::Task");
42 is($nontaskcount, 0, "Each step is a Parrot::Configure::Task object");
43 is($confsteps[0]->step, $step,
44 "'step' element of Parrot::Configure::Task struct identified");
45 ok(! ref($confsteps[0]->object),
46 "'object' element of Parrot::Configure::Task struct is not yet a ref");
48 $conf->options->set(%args);
49 is($conf->options->{c}->{debugging}, 1,
50 "command-line option '--debugging' has been stored in object");
54 my ($stdout, $stderr);
55 capture ( sub {$rv = $conf->runsteps}, \$stdout, \$stderr );
56 ok($rv, "runsteps successfully ran $step");
59 "Got correct description for $step");
61 qr/step $step failed:/,
62 "Got error message expected upon running $step");
65 pass("Completed all tests in $0");
67 ################### DOCUMENTATION ###################
71 041-return_undef.t - see what happens when configuration step returns an
76 % prove t/configure/041-return_undef.t
80 The files in this directory test functionality used by F<Configure.pl>.
82 The tests in this file examine what happens when your configuration step
83 module returns something other than the object but has some other defined
92 Parrot::Configure, F<Configure.pl>.
98 # cperl-indent-level: 4
101 # vim: expandtab shiftwidth=4: