tagged release 0.6.4
[parrot.git] / t / configure / 030-option_or_data.t
blobae492333a6a5365243ea944bed5791ad442e9673
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # 030-option_or_data.t
6 use strict;
7 use warnings;
9 use Test::More tests => 7;
10 use Carp;
11 use lib qw( lib t/configure/testlib );
12 use Parrot::Configure;
13 use Parrot::Configure::Options qw( process_options );
14 use Parrot::Configure::Test qw( test_step_thru_runstep);
15 use IO::CaptureOutput qw | capture |;
17 use_ok(
18     'Parrot::Configure::Step::List', qw|
19         get_steps_list
20         |
23 $| = 1;
24 is( $|, 1, "output autoflush is set" );
26 my $testopt    = q{bindir};
27 my $testoptval = q{mybindir};
28 my $localargv  = [];
29 my $args       = process_options(
30     {
31         mode => q{configure},
32         argv => $localargv,
33     }
35 ok( defined $args, "process_options returned successfully" );
37 my $conf = Parrot::Configure->new;
38 ok( defined $conf, "Parrot::Configure->new() returned okay" );
40 my $step        = q{init::foobar};
41 my $description = 'Determining if your computer does foobar';
43 $conf->add_steps($step);
44 $conf->options->set( %{$args} );
46     my $rv;
47     my $stdout;
48     capture ( sub {$rv    = $conf->runsteps}, \$stdout );
49     like( $stdout, qr/$description/s, "Got message expected upon running $step" );
50     ok( !defined( $conf->option_or_data($testopt) ),
51         "option_or_data returned undef; neither option nor data had been defined" );
54 pass("Completed all tests in $0");
56 ################### DOCUMENTATION ###################
58 =head1 NAME
60 030-option_or_data.t - test C<Parrot::Configure::option_or_data()>
62 =head1 SYNOPSIS
64     % prove t/configure/030-option_or_data.t
66 =head1 DESCRIPTION
68 The files in this directory test functionality used by F<Configure.pl>.
70 This file tests C<Parrot::Configure::option_or_data()> in the case where
71 no value for the tested option has been set on the command line but
72 where no value for the tested option has been located internally by a
73 configuration step.
75 =head1 AUTHOR
77 James E Keenan
79 =head1 SEE ALSO
81 Parrot::Configure, F<Configure.pl>.
83 =cut
85 # Local Variables:
86 #   mode: cperl
87 #   cperl-indent-level: 4
88 #   fill-column: 100
89 # End:
90 # vim: expandtab shiftwidth=4: