2 # Copyright (C) 2007, Parrot Foundation.
9 use Test::More tests => 12;
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(
21 argv => [q{--verbose=2}],
25 ok( defined $args, "process_options returned successfully" );
28 my $conf = Parrot::Configure->new;
29 ok( defined $conf, "Parrot::Configure->new() returned okay" );
31 my $step = q{init::foobar};
32 my $description = 'Determining if your computer does foobar';
34 $conf->add_steps($step);
35 my @confsteps = @{ $conf->steps };
36 isnt( scalar @confsteps, 0,
37 "Parrot::Configure object 'steps' key holds non-empty array reference" );
38 is( scalar @confsteps, 1, "Parrot::Configure object 'steps' key holds ref to 1-element array" );
40 foreach my $k (@confsteps) {
41 $nontaskcount++ unless $k->isa("Parrot::Configure::Task");
43 is( $nontaskcount, 0, "Each step is a Parrot::Configure::Task object" );
44 is( $confsteps[0]->step, $step, "'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},
50 1, "command-line option '--debugging' has been stored in object" );
55 capture ( sub {$rv = $conf->runsteps}, \$stdout );
56 ok( $rv, "runsteps successfully ran $step" );
59 qr/$description\.\.\..*Setting Configuration Data.*verbose.*2.*done/s,
60 "Got message expected upon running $step"
64 pass("Completed all tests in $0");
66 ################### DOCUMENTATION ###################
70 007-verbose_two.t - test bad step failure case in Parrot::Configure
74 % prove t/configure/007-verbose_two.t
78 The files in this directory test functionality used by F<Configure.pl>.
80 The tests in this file examine what happens when you configure with the
81 <--verbose> option set to C<2>.
83 (Since I am testing with only the first step, C<init::manifest>, and since that
84 step has nothing to say when C<--verbose=1>, I have to advance to
93 Parrot::Configure, F<Configure.pl>.
99 # cperl-indent-level: 4
102 # vim: expandtab shiftwidth=4: