tagged release 0.6.4
[parrot.git] / t / configure / 006-bad_step.t
blob1852b578f7e38a20eaaa32ad4fa95235482d25cb
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # 006-bad_step.t
6 use strict;
7 use warnings;
9 use Test::More tests => 11;
10 use Carp;
11 use lib qw( lib );
12 use Parrot::Configure;
13 use Parrot::Configure::Options qw( process_options );
15 $| = 1;
16 is( $|, 1, "output autoflush is set" );
18 my $args = process_options(
19     {
20         argv => [],
21         mode => q{configure},
22     }
24 ok( defined $args, "process_options returned successfully" );
25 my %args = %$args;
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" );
38 my $nontaskcount = 0;
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" );
51 my $rv;
52 eval { $rv = $conf->runsteps; };
53 like(
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 ###################
62 =head1 NAME
64 006-bad_step.t - test bad step failure case in Parrot::Configure
66 =head1 SYNOPSIS
68     % prove t/configure/006-bad_step.t
70 =head1 DESCRIPTION
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.
77 =head1 AUTHOR
79 James E Keenan
81 =head1 SEE ALSO
83 Parrot::Configure, F<Configure.pl>.
85 =cut
87 # Local Variables:
88 #   mode: cperl
89 #   cperl-indent-level: 4
90 #   fill-column: 100
91 # End:
92 # vim: expandtab shiftwidth=4: