Author: jkeenan Date: Sun Dec 2 07:14:19 2007 New Revision: 23364 Added: trunk/t/configure/114-auto_attributes-01.t (contents, props changed) Removed: trunk/t/configure/114-auto_attributes.t Modified: trunk/MANIFEST trunk/config/auto/attributes.pm
Log: Rename one test. When --verbose is set, clarify what happens with bogus attributes. Modified: trunk/MANIFEST ============================================================================== --- trunk/MANIFEST (original) +++ trunk/MANIFEST Sun Dec 2 07:14:19 2007 @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec 2 12:45:17 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec 2 13:36:50 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -3048,7 +3048,7 @@ t/configure/113-auto_msvc-01.t [] t/configure/113-auto_msvc-02.t [] t/configure/113-auto_msvc-03.t [] -t/configure/114-auto_attributes.t [] +t/configure/114-auto_attributes-01.t [] t/configure/115-auto_warnings.t [] t/configure/116-init_optimize-01.t [] t/configure/116-init_optimize-02.t [] Modified: trunk/config/auto/attributes.pm ============================================================================== --- trunk/config/auto/attributes.pm (original) +++ trunk/config/auto/attributes.pm Sun Dec 2 07:14:19 2007 @@ -45,22 +45,20 @@ HASATTRIBUTE_NEVER_WORKS ); -our $verbose; - sub runstep { my ( $self, $conf ) = @_; - $verbose = $conf->options->get('verbose'); + my $verbose = $conf->options->get('verbose'); print "\n" if $verbose; for my $maybe_attr (@potential_attributes) { - $self->try_attr( $conf, $maybe_attr ); + $self->try_attr( $conf, $maybe_attr, $verbose ); } return 1; } sub try_attr { - my ( $self, $conf, $attr ) = @_; + my ( $self, $conf, $attr, $verbose ) = @_; my $output_file = 'test.cco'; @@ -89,7 +87,10 @@ $conf->data->set( $attr => !$exit_code | 0 ); - return if $exit_code; + if ($exit_code) { + $verbose and print "Rejecting bogus attribute: $attr\n"; + return; + } my $output = Parrot::BuildUtil::slurp_file($output_file); $verbose and print " output: $output\n"; Added: trunk/t/configure/114-auto_attributes-01.t ============================================================================== --- (empty file) +++ trunk/t/configure/114-auto_attributes-01.t Sun Dec 2 07:14:19 2007 @@ -0,0 +1,85 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 114-auto_attributes-01.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::attributes'); +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::attributes}; + +$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"); + +# Can't use Parrot::IO::Capture::Mini to tie STDOUT here because the C +# programs inside runstep() are messing with STDOUT. +# So we'll have to infer that verbose output was printed from the +# coverage report. + +$ret = $step->runstep($conf); +ok( defined $ret, "$step_name runstep() returned defined value" ); +unlike($conf->data->get('ccflags'), + qr/HASATTRIBUTE_NEVER_WORKS/, + "'ccflags' excludes bogus attribute as expected" +); + +pass("Completed all tests in $0"); + +################### DOCUMENTATION ################### + +=head1 NAME + +114-auto_attributes-01.t - test config::auto::attributes + +=head1 SYNOPSIS + + % prove t/configure/114-auto_attributes-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::attributes. + +=head1 AUTHOR + +James E Keenan + +=head1 SEE ALSO + +config::auto::attributes, F<Configure.pl>. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: