tagged release 0.6.4
[parrot.git] / t / steps / auto_gcc-09.t
blob428822bb6bb8d63a0cbd9ebc0bcb4e7402d8777a
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # auto_gcc-09.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::gcc');
13 use Parrot::Configure;
14 use Parrot::Configure::Options qw( process_options );
15 use Parrot::Configure::Test qw( test_step_thru_runstep);
16 use IO::CaptureOutput qw | capture |;
18 my $args = process_options( {
19     argv            => [ q{--verbose} ],
20     mode            => q{configure},
21 } );
23 my $conf = Parrot::Configure->new();
25 test_step_thru_runstep($conf, q{init::defaults}, $args);
27 my ($task, $step_name, $step, $ret);
28 my $pkg = q{auto::gcc};
30 $conf->add_steps($pkg);
31 $conf->options->set(%{$args});
32 $task = $conf->steps->[-1];
33 $step_name   = $task->step;
35 $step = $step_name->new();
36 ok(defined $step, "$step_name constructor returned defined value");
37 isa_ok($step, $step_name);
41     my $rv;
42     my $stdout;
43     my $gnucref = {};
44     $gnucref->{__GNUC__} = q{123};
45     $gnucref->{__GNUC_MINOR__} = q{456};
46     capture ( sub {$rv = $step->_evaluate_gcc($conf, $gnucref) }, \$stdout);
47     ok($rv, "_evaluate_gcc() returned true value");
48     ok( $stdout, "verbose output captured" );
49     ok(defined $conf->data->get( 'gccversion' ),
50         "gccversion defined as expected");
51     is($conf->data->get( 'gccversion' ), q{123.456},
52         "Got expected value for gccversion");
53     is($step->result(), q{yes}, "Got expected result");
57 pass("Completed all tests in $0");
59 ################### DOCUMENTATION ###################
61 =head1 NAME
63 auto_gcc-09.t - test config::auto::gcc
65 =head1 SYNOPSIS
67     % prove t/steps/auto_gcc-09.t
69 =head1 DESCRIPTION
71 The files in this directory test functionality used by F<Configure.pl>.
73 The tests in this file test subroutines exported by config::auto::gcc.
75 =head1 AUTHOR
77 James E Keenan
79 =head1 SEE ALSO
81 config::auto::gcc, 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: