* t/pmc/complex.t:
[parrot.git] / t / steps / auto_arch-02.t
blob28025c568d5ceac38b15dd4d278cb10f1b8b54e8
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # auto_arch-02.t
6 use strict;
7 use warnings;
8 use Test::More tests => 14;
9 use Carp;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::auto::arch');
13 use Parrot::Configure;
14 use Parrot::Configure::Options qw( process_options );
15 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 my $args = process_options(
18     {
19         argv => [ ],
20         mode => q{configure},
21     }
24 my $conf = Parrot::Configure->new;
26 test_step_thru_runstep( $conf, q{init::defaults}, $args );
28 my $pkg = q{auto::arch};
30 $conf->add_steps($pkg);
31 $conf->options->set( %{$args} );
33 my ( $task, $step_name, $step);
34 $task        = $conf->steps->[1];
35 $step_name   = $task->step;
37 $step = $step_name->new();
38 ok( defined $step, "$step_name constructor returned defined value" );
39 isa_ok( $step, $step_name );
40 ok( $step->description(), "$step_name has description" );
42 my $errstr;
44     # As the t/configure/ test suite is currently (Dec 25 2007) constructed,
45     # an uninitialized value warning is generated when this test is run on
46     # Darwin because of a hack in config/auto/arch.pm.  We capture the warning
47     # and verify that we did so if on Darwin.  In the future, we will be able
48     # to eliminate this use of the signal handler because the
49     # Parrot::Configure object will have the same information available to it
50     # as it does during regular configuration.
51     local $SIG{__WARN__} = \&_capture;
52     my $ret = $step->runstep($conf);
53     ok( $ret, "$step_name runstep() returned true value" );
54     is($step->result(), q{}, "Result was empty string as expected");
55     if ($^O eq 'darwin') {
56         like(
57             $errstr,
58             qr/Uninitialized value/i,
59             "Caught uninitialized value warning as expected"
60         );
61     } else {
62         pass("Test not needed except on Darwin");
63     }
66 pass("Keep Devel::Cover happy");
67 pass("Completed all tests in $0");
69 sub _capture { $errstr = $_[0]; }
71 ################### DOCUMENTATION ###################
73 =head1 NAME
75 auto_arch-02.t - test config::auto::arch
77 =head1 SYNOPSIS
79     % prove t/steps/auto_arch-02.t
81 =head1 DESCRIPTION
83 The files in this directory test functionality used by F<Configure.pl>.
85 The tests in this file test config::auto::arch in its typical case.
87 =head1 AUTHOR
89 James E Keenan
91 =head1 SEE ALSO
93 config::auto::arch, F<Configure.pl>.
95 =cut
97 # Local Variables:
98 #   mode: cperl
99 #   cperl-indent-level: 4
100 #   fill-column: 100
101 # End:
102 # vim: expandtab shiftwidth=4: