2 # Copyright (C) 2007, Parrot Foundation.
9 use Test::More tests => 11;
12 use Parrot::Configure;
13 use Parrot::Configure::Options qw( process_options );
16 is( $|, 1, "output autoflush is set" );
18 my ($args, $step_list_ref) = process_options(
24 ok( defined $args, "process_options returned successfully" );
27 my $conf = Parrot::Configure->new;
28 ok( defined $conf, "Parrot::Configure->new() returned okay" );
30 my $badstep = q{bad::step};
31 my $badsteppath = q{bad/step.pm};
33 $conf->add_steps($badstep);
34 my @confsteps = @{ $conf->steps };
35 isnt( scalar @confsteps, 0,
36 "Parrot::Configure object 'steps' key holds non-empty array reference" );
37 is( scalar @confsteps, 1, "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, $badstep, "'step' element of Parrot::Configure::Task struct identified" );
44 ok( !ref( $confsteps[0]->object ),
45 "'object' element of Parrot::Configure::Task struct is not yet a ref" );
47 $conf->options->set(%args);
48 is( $conf->options->{c}->{debugging},
49 1, "command-line option '--debugging' has been stored in object" );
52 eval { $rv = $conf->runsteps; };
54 $@, qr/Can't locate $badsteppath in \@INC/, #'
55 "Got expected die message when runsteps() called with nonexistent step"
58 pass("Completed all tests in $0");
60 ################### DOCUMENTATION ###################
64 006-bad_step.t - test bad step failure case in Parrot::Configure
68 % prove t/configure/006-bad_step.t
72 The files in this directory test functionality used by F<Configure.pl>.
74 The tests in this file examine what happens when you attempt to do a
75 C<runsteps> on a non-existent step.
83 Parrot::Configure, F<Configure.pl>.
89 # cperl-indent-level: 4
92 # vim: expandtab shiftwidth=4: