fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / t / steps / auto / snprintf-01.t
blob172b7cd9df598fff2ca529b7782d20e0aa683e89
1 #! perl
2 # Copyright (C) 2007, Parrot Foundation.
3 # $Id$
4 # auto/snprintf-01.t
6 use strict;
7 use warnings;
8 use Test::More tests => 18;
9 use Carp;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::auto::snprintf');
12 use Parrot::Configure::Options qw( process_options );
13 use Parrot::Configure::Step::Test;
14 use Parrot::Configure::Test qw(
15     test_step_constructor_and_description
17 use IO::CaptureOutput qw| capture |;
19 ########## regular ##########
21 my ($args, $step_list_ref) = process_options( {
22     argv            => [],
23     mode            => q{configure},
24 } );
26 my $conf = Parrot::Configure::Step::Test->new;
27 $conf->include_config_results( $args );
29 my $pkg = q{auto::snprintf};
31 $conf->add_steps($pkg);
33 my $serialized = $conf->pcfreeze();
35 $conf->options->set(%{$args});
36 my $step = test_step_constructor_and_description($conf);
38 $conf->replenish($serialized);
40 ########## _evaluate_snprintf() ##########
42 ($args, $step_list_ref) = process_options( {
43     argv            => [],
44     mode            => q{configure},
45 } );
46 $conf->options->set(%{$args});
47 $step = test_step_constructor_and_description($conf);
49 my $res;
50 $res = q{old snprintf};
51 ok($step->_evaluate_snprintf($conf, $res),
52     "_evaluate_snprintf returned true value");
53 ok($conf->data->get('HAS_OLD_SNPRINTF'),
54     "Got expected value");
56 $res = q{C99 snprintf};
57 ok($step->_evaluate_snprintf($conf, $res),
58     "_evaluate_snprintf returned true value");
59 ok($conf->data->get('HAS_C99_SNPRINTF'),
60     "Got expected value");
61 ok($conf->data->get('HAS_SNPRINTF'),
62     "Got expected value");
64 $conf->replenish($serialized);
66 ########## --verbose; _evaluate_snprintf() ##########
68 ($args, $step_list_ref) = process_options( {
69     argv            => [ q{--verbose} ],
70     mode            => q{configure},
71 } );
72 $conf->options->set(%{$args});
73 $step = test_step_constructor_and_description($conf);
76     my $stdout;
77     my $res = q{snprintf};
78     my $ret = capture(
79         sub { $step->_evaluate_snprintf($conf, $res) },
80         \$stdout
81     );
82     ok($ret, "_evaluate_snprintf returned true value");
83     ok($conf->data->get('HAS_SNPRINTF'),
84         "Got expected value");
87 $conf->cc_clean();
89 pass("Completed all tests in $0");
91 ################### DOCUMENTATION ###################
93 =head1 NAME
95 auto/snprintf-01.t - test auto::snprintf
97 =head1 SYNOPSIS
99     % prove t/steps/auto/snprintf-01.t
101 =head1 DESCRIPTION
103 The files in this directory test functionality used by F<Configure.pl>.
105 The tests in this file test auto::snprintf.
107 =head1 AUTHOR
109 James E Keenan
111 =head1 SEE ALSO
113 config::auto::snprintf, F<Configure.pl>.
115 =cut
117 # Local Variables:
118 #   mode: cperl
119 #   cperl-indent-level: 4
120 #   fill-column: 100
121 # End:
122 # vim: expandtab shiftwidth=4: