2 # Copyright (C) 2008, The Perl Foundation.
7 use Test::More tests => 24;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::auto::crypto');
13 use Parrot::Configure;
14 use Parrot::Configure::Options qw( process_options );
15 use Parrot::Configure::Test qw( test_step_thru_runstep);
16 use IO::CaptureOutput qw| capture |;
18 my $args = process_options(
25 my $conf = Parrot::Configure->new;
27 test_step_thru_runstep( $conf, q{init::defaults}, $args );
29 my $pkg = q{auto::crypto};
31 $conf->add_steps($pkg);
32 $conf->options->set( %{$args} );
34 my ($task, $step_name, $step);
35 $task = $conf->steps->[-1];
36 $step_name = $task->step;
38 $step = $step_name->new();
39 ok( defined $step, "$step_name constructor returned defined value" );
40 isa_ok( $step, $step_name );
42 # Mock different OS/compiler combinations.
43 my ($osname, $cc, $initial_libs);
44 $initial_libs = $conf->data->get('libs');
47 ok($step->_add_to_libs( {
51 win32_nongcc => 'libcrypto.lib',
52 default => '-lcrypto',
54 "_add_to_libs() returned true value");
55 like($conf->data->get('libs'),
57 "'libs' attribute modified as expected");
58 # Restore setting for next test
59 $conf->data->set( libs => $initial_libs );
63 ok($step->_add_to_libs( {
67 win32_nongcc => 'libcrypto.lib',
68 default => '-lcrypto',
70 "_add_to_libs() returned true value");
71 like($conf->data->get('libs'),
73 "'libs' attribute modified as expected");
74 # Restore setting for next test
75 $conf->data->set( libs => $initial_libs );
79 ok($step->_add_to_libs( {
83 win32_nongcc => 'libcrypto.lib',
84 default => '-lcrypto',
86 "_add_to_libs() returned true value");
87 like($conf->data->get('libs'),
89 "'libs' attribute modified as expected");
90 # Restore setting for next test
91 $conf->data->set( libs => $initial_libs );
93 my ($libs, $ccflags, $linkflags, $verbose);
97 $linkflags = q{-Lgamma};
99 $step->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose);
100 like($conf->data->get('libs'), qr/$libs/,
101 "Got expected value for 'libs'");
102 like($conf->data->get('ccflags'), qr/$ccflags/,
103 "Got expected value for 'ccflags'");
104 like($conf->data->get('linkflags'), qr/$linkflags/,
105 "Got expected value for 'linkflags'");
106 is($step->result, 'no', "Expected result was set");
111 $ccflags = q{-Ibeta};
112 $linkflags = q{-Lgamma};
115 sub { $step->_recheck_settings(
116 $conf, $libs, $ccflags, $linkflags, $verbose); },
119 like($conf->data->get('libs'), qr/$libs/,
120 "Got expected value for 'libs'");
121 like($conf->data->get('ccflags'), qr/$ccflags/,
122 "Got expected value for 'ccflags'");
123 like($conf->data->get('linkflags'), qr/$linkflags/,
124 "Got expected value for 'linkflags'");
125 is($step->result, 'no', "Expected result was set");
126 like($stdout, qr/\(no\)/, "Got expected verbose output");
129 pass("Completed all tests in $0");
131 ################### DOCUMENTATION ###################
135 auto_crypto-02.t - test config::auto::crypto
139 % prove t/steps/auto_crypto-02.t
143 The files in this directory test functionality used by F<Configure.pl>.
145 The tests in this file test config::auto::crypto.
149 Mostly taken from F<t/steps/auto_gdbm-04.t>.
157 config::auto::crypto, F<Configure.pl>.
163 # cperl-indent-level: 4
166 # vim: expandtab shiftwidth=4: