Permalink
Browse files

Eliminate direct lookup from Perl 5 %Config. Do lookup in init::defau…

…lts and use results in auto::format. Adjust step test accordingly.

git-svn-id: https://svn.parrot.org/parrot/branches/auto_format_no_Config@42353 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 52d842e commit 28665cbeed9f7ca52a00ea5d5f015206649eadbd jkeenan committed Nov 8, 2009
Showing with 11 additions and 8 deletions.
  1. +3 −3 config/auto/format.pm
  2. +1 −0 config/init/defaults.pm
  3. +7 −5 t/steps/auto/format-01.t
@@ -15,7 +15,6 @@ package auto::format;
use strict;
use warnings;
-use Config; # for long double printf format
use base qw(Parrot::Configure::Step);
@@ -75,8 +74,9 @@ sub _set_floatvalfmt_nvsize {
# Stay way from long double for now (it may be 64 or 80 bits)
# die "long double not supported at this time, use double.";
$nvsize = $ldsize;
- if (defined($Config{'sPRIgldbl'})) {
- $nvformat = "%.15" . $Config{'sPRIgldbl'};
+ my $spri = $conf->data->get_p5('sPRIgldbl');
+ if ( defined $spri ) {
+ $nvformat = "%.15" . $spri;
$nvformat =~ s/"//g; # Perl 5's Config value has embedded double quotes
}
else {
@@ -59,6 +59,7 @@ sub runstep {
sig_name
scriptdirexp
use64bitint
+ sPRIgldbl
| ) {
$conf->data->set_p5( $orig => $Config{$orig} );
}
@@ -5,9 +5,10 @@
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 21;
use Carp;
use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
use_ok('config::auto::format');
use Parrot::BuildUtil;
use Parrot::Configure;
@@ -26,6 +27,8 @@ my ($args, $step_list_ref) = process_options( {
my $conf = Parrot::Configure->new();
+test_step_thru_runstep( $conf, q{init::defaults}, $args );
+
my ($task, $step_name, $step, $ret);
my $pkg = q{auto::format};
@@ -97,15 +100,14 @@ $step = test_step_constructor_and_description($conf);
);
}
{
- use Config;
- my $p5format = '%.15' . $Config{sPRIgldbl};
+ my $p5format = '%.15' . $conf->data->get_p5('sPRIgldbl');
$p5format =~ s/"//g;; # Perl 5's Config value has embedded double quotes
$conf->data->set( nv => 'long double' );
auto::format::_set_floatvalfmt_nvsize($conf);
is($conf->data->get( 'floatvalfmt' ), $p5format,
- "floatvalfmt set as expected");
+ "floatvalfmt set as expected: nv long double");
is($conf->data->get( 'nvsize' ), $conf->data->get( 'hugefloatvalsize' ),
- "nvsize set as expected");
+ "nvsize set as expected: nv long double");
$conf->data->set(
nv => undef,
floatvalfmt => undef,

0 comments on commit 28665cb

Please sign in to comment.