Ticket #1236: auto.format.diff
File auto.format.diff, 2.7 KB (added by jkeenan, 12 years ago) |
---|
-
t/steps/auto/format-01.t
5 5 6 6 use strict; 7 7 use warnings; 8 use Test::More tests => 16;8 use Test::More tests => 21; 9 9 use Carp; 10 10 use lib qw( lib t/configure/testlib ); 11 use_ok('config::init::defaults'); 11 12 use_ok('config::auto::format'); 12 13 use Parrot::BuildUtil; 13 14 use Parrot::Configure; … … 26 27 27 28 my $conf = Parrot::Configure->new(); 28 29 30 test_step_thru_runstep( $conf, q{init::defaults}, $args ); 31 29 32 my ($task, $step_name, $step, $ret); 30 33 my $pkg = q{auto::format}; 31 34 … … 97 100 ); 98 101 } 99 102 { 100 use Config; 101 my $p5format = '%.15' . $Config{sPRIgldbl}; 103 my $p5format = '%.15' . $conf->data->get_p5('sPRIgldbl'); 102 104 $p5format =~ s/"//g;; # Perl 5's Config value has embedded double quotes 103 105 $conf->data->set( nv => 'long double' ); 104 106 auto::format::_set_floatvalfmt_nvsize($conf); 105 107 is($conf->data->get( 'floatvalfmt' ), $p5format, 106 "floatvalfmt set as expected ");108 "floatvalfmt set as expected: nv long double"); 107 109 is($conf->data->get( 'nvsize' ), $conf->data->get( 'hugefloatvalsize' ), 108 "nvsize set as expected ");110 "nvsize set as expected: nv long double"); 109 111 $conf->data->set( 110 112 nv => undef, 111 113 floatvalfmt => undef, -
config/init/defaults.pm
59 59 sig_name 60 60 scriptdirexp 61 61 use64bitint 62 sPRIgldbl 62 63 | ) { 63 64 $conf->data->set_p5( $orig => $Config{$orig} ); 64 65 } -
config/auto/format.pm
15 15 16 16 use strict; 17 17 use warnings; 18 use Config; # for long double printf format19 18 20 19 use base qw(Parrot::Configure::Step); 21 20 … … 75 74 # Stay way from long double for now (it may be 64 or 80 bits) 76 75 # die "long double not supported at this time, use double."; 77 76 $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; 80 80 $nvformat =~ s/"//g; # Perl 5's Config value has embedded double quotes 81 81 } 82 82 else {