2 # Copyright (C) 2007, The Perl Foundation.
8 use Test::More tests => 14;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::auto::format');
13 use Parrot::BuildUtil;
14 use Parrot::Configure;
15 use Parrot::Configure::Options qw( process_options );
16 use Parrot::Configure::Test qw( test_step_thru_runstep);
18 my $args = process_options( {
23 my $conf = Parrot::Configure->new();
25 test_step_thru_runstep($conf, q{init::defaults}, $args);
27 my ($task, $step_name, $step, $ret);
28 my $pkg = q{auto::format};
30 $conf->add_steps($pkg);
31 $conf->options->set(%{$args});
33 $task = $conf->steps->[-1];
34 $step_name = $task->step;
36 $step = $step_name->new();
37 ok(defined $step, "$step_name constructor returned defined value");
38 isa_ok($step, $step_name);
42 $conf->data->set( nv => 'double' );
43 auto::format::_set_floatvalfmt_nvsize($conf);
44 is($conf->data->get( 'floatvalfmt' ), '%f',
45 "floatvalfmt set as expected");
46 is($conf->data->get( 'nvsize' ), $conf->data->get( 'doublesize' ),
47 "nvsize set as expected");
56 $conf->data->set( nv => 'long double' );
57 auto::format::_set_floatvalfmt_nvsize($conf);
58 is($conf->data->get( 'floatvalfmt' ), '%Lf',
59 "floatvalfmt set as expected");
60 is($conf->data->get( 'nvsize' ), $conf->data->get( 'hugefloatvalsize' ),
61 "nvsize set as expected");
71 $conf->data->set( nv => 'foobar' );
72 eval { auto::format::_set_floatvalfmt_nvsize($conf); };
74 qr/Can't find a printf-style format specifier for type '$type'/, #'
75 "Got expected error message");
79 pass("Completed all tests in $0");
81 ################### DOCUMENTATION ###################
85 auto_format-02.t - test config::auto::format
89 % prove t/steps/auto_format-02.t
93 The files in this directory test functionality used by F<Configure.pl>.
95 The tests in this file test subroutines exported by config::auto::format.
103 config::auto::format, F<Configure.pl>.
109 # cperl-indent-level: 4
112 # vim: expandtab shiftwidth=4: