Ticket #1236: auto.format.diff

File auto.format.diff, 2.7 KB (added by jkeenan, 4 years ago)
  • t/steps/auto/format-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests => 16; 
     8use Test::More tests => 21; 
    99use Carp; 
    1010use lib qw( lib t/configure/testlib ); 
     11use_ok('config::init::defaults'); 
    1112use_ok('config::auto::format'); 
    1213use Parrot::BuildUtil; 
    1314use Parrot::Configure; 
     
    2627 
    2728my $conf = Parrot::Configure->new(); 
    2829 
     30test_step_thru_runstep( $conf, q{init::defaults}, $args ); 
     31 
    2932my ($task, $step_name, $step, $ret); 
    3033my $pkg = q{auto::format}; 
    3134 
     
    97100    ); 
    98101} 
    99102{ 
    100     use Config; 
    101     my $p5format = '%.15' . $Config{sPRIgldbl}; 
     103    my $p5format = '%.15' . $conf->data->get_p5('sPRIgldbl'); 
    102104    $p5format =~ s/"//g;; # Perl 5's Config value has embedded double quotes 
    103105    $conf->data->set( nv => 'long double' ); 
    104106    auto::format::_set_floatvalfmt_nvsize($conf); 
    105107    is($conf->data->get( 'floatvalfmt' ), $p5format, 
    106         "floatvalfmt set as expected"); 
     108        "floatvalfmt set as expected: nv long double"); 
    107109    is($conf->data->get( 'nvsize' ), $conf->data->get( 'hugefloatvalsize' ), 
    108         "nvsize set as expected"); 
     110        "nvsize set as expected: nv long double"); 
    109111    $conf->data->set( 
    110112        nv          => undef, 
    111113        floatvalfmt => undef, 
  • config/init/defaults.pm

     
    5959        sig_name 
    6060        scriptdirexp 
    6161        use64bitint 
     62        sPRIgldbl 
    6263    | ) { 
    6364        $conf->data->set_p5( $orig => $Config{$orig} ); 
    6465    } 
  • config/auto/format.pm

     
    1515 
    1616use strict; 
    1717use warnings; 
    18 use Config;  # for long double printf format 
    1918 
    2019use base qw(Parrot::Configure::Step); 
    2120 
     
    7574        # Stay way from long double for now (it may be 64 or 80 bits) 
    7675        # die "long double not supported at this time, use double."; 
    7776        $nvsize   = $ldsize; 
    78         if (defined($Config{'sPRIgldbl'})) { 
    79             $nvformat = "%.15" .  $Config{'sPRIgldbl'}; 
     77        my $spri = $conf->data->get_p5('sPRIgldbl'); 
     78        if ( defined $spri ) { 
     79            $nvformat = "%.15" .  $spri; 
    8080            $nvformat =~ s/"//g;   # Perl 5's Config value has embedded double quotes 
    8181        } 
    8282        else {