Author: jkeenan
Date: Sun Oct 28 10:30:15 2007
New Revision: 22566

Added:
   branches/autogcc/t/configure/111-auto_gcc-01.t   (contents, props changed)
   branches/autogcc/t/configure/111-auto_gcc-02.t   (contents, props changed)
   branches/autogcc/t/configure/111-auto_gcc-03.t   (contents, props changed)
   branches/autogcc/t/configure/111-auto_gcc-04.t   (contents, props changed)
   branches/autogcc/t/configure/111-auto_gcc-05.t   (contents, props changed)
   branches/autogcc/t/configure/111-auto_gcc-06.t   (contents, props changed)
   branches/autogcc/t/configure/111-auto_gcc-07.t   (contents, props changed)
   branches/autogcc/t/configure/111-auto_gcc-08.t   (contents, props changed)
Removed:
   branches/autogcc/t/configure/111-auto_gcc.t
Modified:
   branches/autogcc/MANIFEST
   branches/autogcc/config/auto/gcc.pm

Log:
autogcc branch was created to accommodate testing and refactoring of 
configuration step class auto::gcc.  8 test files so far.

Modified: branches/autogcc/MANIFEST
==============================================================================
--- branches/autogcc/MANIFEST   (original)
+++ branches/autogcc/MANIFEST   Sun Oct 28 10:30:15 2007
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Oct 28 02:27:43 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Oct 28 17:26:13 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -3004,7 +3004,14 @@
 t/configure/110-inter_yacc-03.t                             []
 t/configure/110-inter_yacc-04.t                             []
 t/configure/110-inter_yacc-05.t                             []
-t/configure/111-auto_gcc.t                                  []
+t/configure/111-auto_gcc-01.t                               []
+t/configure/111-auto_gcc-02.t                               []
+t/configure/111-auto_gcc-03.t                               []
+t/configure/111-auto_gcc-04.t                               []
+t/configure/111-auto_gcc-05.t                               []
+t/configure/111-auto_gcc-06.t                               []
+t/configure/111-auto_gcc-07.t                               []
+t/configure/111-auto_gcc-08.t                               []
 t/configure/112-auto_backtrace.t                            []
 t/configure/113-auto_msvc.t                                 []
 t/configure/114-auto_attributes.t                           []

Modified: branches/autogcc/config/auto/gcc.pm
==============================================================================
--- branches/autogcc/config/auto/gcc.pm (original)
+++ branches/autogcc/config/auto/gcc.pm Sun Oct 28 10:30:15 2007
@@ -32,34 +32,37 @@
 
 sub runstep {
     my ( $self, $conf ) = @_;
+    my $gnucref = _probe_for_gcc();
+    my $rv = $self->_evaluate_gcc($conf, $gnucref);
+    return $rv;
+}
 
-    my $verbose = $conf->options->get('verbose');
-    my $maint   = $conf->options->get('maintainer');
-
-    my %gnuc;
-
+sub _probe_for_gcc {
     cc_gen("config/auto/gcc/test_c.in");
     cc_build();
-    %gnuc = eval cc_run() or die "Can't run the test program: $!";
+    my %gnuc = eval cc_run() or die "Can't run the test program: $!";
     cc_clean();
+    return \%gnuc;
+}
 
-    my ( $gccversion, $warns, $ccwarn );
-    $ccwarn = $conf->data->get('ccwarn');
+sub _evaluate_gcc {
+    my ($self, $conf, $gnucref) = @_;
 
     # Set gccversion to undef.  This will also trigger any hints-file
     # callbacks that depend on knowing whether or not we're using gcc.
 
     # This key should always exist unless the program couldn't be run,
     # which should have been caught by the 'die' above.
-    unless ( exists $gnuc{__GNUC__} ) {
+    unless ( exists $gnucref->{__GNUC__} ) {
         $conf->data->set( gccversion => undef );
         return 1;
     }
 
-    my $major = $gnuc{__GNUC__};
-    my $minor = $gnuc{__GNUC_MINOR__};
-    my $intel = $gnuc{__INTEL_COMPILER};
+    my $major = $gnucref->{__GNUC__};
+    my $minor = $gnucref->{__GNUC_MINOR__};
+    my $intel = $gnucref->{__INTEL_COMPILER};
 
+    my $verbose = $conf->options->get('verbose');
     if ( defined $intel || !defined $major ) {
         print " (no) " if $verbose;
         $self->set_result('no');
@@ -72,13 +75,20 @@
     if ( defined $minor and $minor =~ tr/0-9//c ) {
         undef $minor;    # Don't use it
     }
-    if ( defined $major ) {
-        $gccversion = $major;
-        $gccversion .= ".$minor" if defined $minor;
+    if ( ! defined $major ) {
+        print " (no) " if $verbose;
+        $self->set_result('no');
+        $conf->data->set( gccversion => undef );
+        return 1;
     }
+    my $gccversion = $major;
+    $gccversion .= ".$minor" if defined $minor;
     print " (yep: $gccversion )" if $verbose;
     $self->set_result('yes');
 
+    my $warns;
+    my $ccwarn = $conf->data->get('ccwarn');
+
     if ($gccversion) {
 
         # If using gcc, crank up its warnings as much as possible and make it
@@ -136,7 +146,11 @@
                 . " -Wundef"
                 . " -Wunknown-pragmas"
                 . " -Wwrite-strings"
-                . ( $maint ? " -Wlarger-than-4096" : "" ),
+                . (
+                    $conf->options->get('maintainer')
+                    ? " -Wlarger-than-4096"
+                    : ""
+                  ),
 
             # others; ones we might like marked with ?
             # ? -Wundef for undefined idenfiers in #if
@@ -374,27 +388,22 @@
         if $gccversion >= 4.0;
 
     if ( defined $conf->options->get('miniparrot') && $gccversion ) {
-
         # make the compiler act as ANSIish as possible, and avoid enabling
         # support for GCC-specific features.
-
         $conf->data->set(
             ccwarn     => "-ansi -pedantic",
             gccversion => undef
         );
-
-        return 1;
     }
-
-    $conf->data->set(
-        ccwarn              => "$warns $ccwarn",
-        gccversion          => $gccversion,
-        HAS_aligned_funcptr => 1
-    );
-
-    $conf->data->set( HAS_aligned_funcptr => 0 )
-        if $^O eq 'hpux';
-
+    else {
+        $conf->data->set(
+            ccwarn              => "$warns $ccwarn",
+            gccversion          => $gccversion,
+            HAS_aligned_funcptr => 1
+        );
+        $conf->data->set( HAS_aligned_funcptr => 0 )
+            if $^O eq 'hpux';
+    }
     return 1;
 }
 

Added: branches/autogcc/t/configure/111-auto_gcc-01.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-01.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,76 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-01.t
+
+use strict;
+use warnings;
+use Test::More qw(no_plan); # tests => 11;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+    argv            => [],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+ok($step->runstep($conf), "runstep returned true value");
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-01.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-01.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/autogcc/t/configure/111-auto_gcc-02.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-02.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,80 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-02.t
+
+use strict;
+use warnings;
+use Test::More tests => 12;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+    argv            => [],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+my $gnucref = {};
+ok($step->_evaluate_gcc($conf, $gnucref),
+    "_evaluate_gcc() returned true value");
+ok(! defined $conf->data->get( 'gccversion' ),
+    "gccversion undef as expected");
+
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-02.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-02.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/autogcc/t/configure/111-auto_gcc-03.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-03.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,84 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-03.t
+
+use strict;
+use warnings;
+use Test::More tests => 13;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+    argv            => [],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+my $gnucref = {};
+$gnucref->{__GNUC__} = 1;
+$gnucref->{__INTEL_COMPILER} = 1;
+
+ok($step->_evaluate_gcc($conf, $gnucref),
+    "_evaluate_gcc() returned true value");
+ok(! defined $conf->data->get( 'gccversion' ),
+    "gccversion undef as expected");
+is($step->result(), q{no}, "Got expected result");
+
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-03.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-03.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/autogcc/t/configure/111-auto_gcc-04.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-04.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,90 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-04.t
+
+use strict;
+use warnings;
+use Test::More tests => 15;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::IO::Capture::Mini;
+
+my $args = process_options( {
+    argv            => [ q{--verbose} ],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+    my $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    my $gnucref = {};
+    $gnucref->{__GNUC__} = undef;
+    ok($step->_evaluate_gcc($conf, $gnucref),
+        "_evaluate_gcc() returned true value");
+    my @more_lines = $tie_out->READLINE;
+    ok( @more_lines, "verbose output captured" );
+    ok(! defined $conf->data->get( 'gccversion' ),
+        "gccversion undef as expected");
+    is($step->result(), q{no}, "Got expected result");
+}
+untie *STDOUT;
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-04.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-04.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/autogcc/t/configure/111-auto_gcc-05.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-05.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,84 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-05.t
+
+use strict;
+use warnings;
+use Test::More tests => 13;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+    argv            => [],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+my $gnucref = {};
+$gnucref->{__GNUC__} = 1;
+$gnucref->{__INTEL_COMPILER} = 1;
+
+ok($step->_evaluate_gcc($conf, $gnucref),
+    "_evaluate_gcc() returned true value");
+ok(! defined $conf->data->get( 'gccversion' ),
+    "gccversion undef as expected");
+is($step->result(), q{no}, "Got expected result");
+
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-05.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-05.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/autogcc/t/configure/111-auto_gcc-06.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-06.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,90 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-06.t
+
+use strict;
+use warnings;
+use Test::More tests => 15;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::IO::Capture::Mini;
+
+my $args = process_options( {
+    argv            => [ q{--verbose} ],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+    my $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    my $gnucref = {};
+    $gnucref->{__GNUC__} = q{abc123};
+    ok($step->_evaluate_gcc($conf, $gnucref),
+        "_evaluate_gcc() returned true value");
+    my @more_lines = $tie_out->READLINE;
+    ok( @more_lines, "verbose output captured" );
+    ok(! defined $conf->data->get( 'gccversion' ),
+        "gccversion undef as expected");
+    is($step->result(), q{no}, "Got expected result");
+}
+untie *STDOUT;
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-06.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-06.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/autogcc/t/configure/111-auto_gcc-07.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-07.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,93 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-07.t
+
+use strict;
+use warnings;
+use Test::More tests => 16;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::IO::Capture::Mini;
+
+my $args = process_options( {
+    argv            => [ q{--verbose} ],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+    my $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    my $gnucref = {};
+    $gnucref->{__GNUC__} = q{123};
+    $gnucref->{__GNUC_MINOR__} = q{abc};
+    ok($step->_evaluate_gcc($conf, $gnucref),
+        "_evaluate_gcc() returned true value");
+    my @more_lines = $tie_out->READLINE;
+    ok( @more_lines, "verbose output captured" );
+    ok(defined $conf->data->get( 'gccversion' ),
+        "gccversion defined as expected");
+    is($conf->data->get( 'gccversion' ), 123,
+        "Got expected value for gccversion");
+    is($step->result(), q{yes}, "Got expected result");
+}
+untie *STDOUT;
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-07.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-07.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/autogcc/t/configure/111-auto_gcc-08.t
==============================================================================
--- (empty file)
+++ branches/autogcc/t/configure/111-auto_gcc-08.t      Sun Oct 28 10:30:15 2007
@@ -0,0 +1,93 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 111-auto_gcc-08.t
+
+use strict;
+use warnings;
+use Test::More tests => 16;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::gcc');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+use Parrot::IO::Capture::Mini;
+
+my $args = process_options( {
+    argv            => [ q{--verbose} ],
+    mode            => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, @step_params, $step, $ret);
+my $pkg = q{auto::gcc};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[1];
+$step_name   = $task->step;
[EMAIL PROTECTED] = @{ $task->params };
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+    my $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini"
+        or croak "Unable to tie";
+    my $gnucref = {};
+    $gnucref->{__GNUC__} = q{123};
+    $gnucref->{__GNUC_MINOR__} = q{456};
+    ok($step->_evaluate_gcc($conf, $gnucref),
+        "_evaluate_gcc() returned true value");
+    my @more_lines = $tie_out->READLINE;
+    ok( @more_lines, "verbose output captured" );
+    ok(defined $conf->data->get( 'gccversion' ),
+        "gccversion defined as expected");
+    is($conf->data->get( 'gccversion' ), q{123.456},
+        "Got expected value for gccversion");
+    is($step->result(), q{yes}, "Got expected result");
+}
+untie *STDOUT;
+
+pass("Keep Devel::Cover happy");
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+111-auto_gcc-08.t - test config::auto::gcc
+
+=head1 SYNOPSIS
+
+    % prove t/configure/111-auto_gcc-08.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by config::auto::gcc.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::gcc, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Reply via email to