2 # Copyright (C) 2007, Parrot Foundation.
8 use Test::More tests => 15;
12 use File::Temp qw( tempdir );
14 use_ok('config::auto::readline');
15 use Parrot::Configure::Options qw( process_options );
16 use Parrot::Configure::Step::Test;
17 use Parrot::Configure::Test qw(
18 test_step_constructor_and_description
20 use IO::CaptureOutput qw | capture |;
22 ########## _select_lib() ##########
24 my ($args, $step_list_ref) = process_options(
26 argv => [ '--without-readline' ],
31 my $conf = Parrot::Configure::Step::Test->new;
32 $conf->include_config_results( $args );
33 my $serialized = $conf->pcfreeze();
35 my $pkg = q{auto::readline};
37 $conf->add_steps($pkg);
38 $conf->options->set( %{$args} );
39 my $step = test_step_constructor_and_description($conf);
41 my $ret = $step->runstep($conf);
42 ok( $ret, "runstep() returned true value" );
43 is($step->result(), q{not requested},
44 "Got expected result for 'without-readline'");
45 is($conf->data->get('HAS_READLINE'), 0,
46 "Got expected value for HAS_READLINE");
48 $conf->replenish($serialized);
50 ($args, $step_list_ref) = process_options(
57 $conf->add_steps($pkg);
58 $conf->options->set( %{$args} );
59 $step = test_step_constructor_and_description($conf);
61 # Mock values for OS and C-compiler
65 is($step->_select_lib( {
69 win32_nongcc => 'readline.lib',
70 default => '-lreadline',
73 "_select_lib() returned expected value");
77 is($step->_select_lib( {
81 win32_nongcc => 'readline.lib',
82 default => '-lreadline',
85 "_select_lib() returned expected value");
89 is($step->_select_lib( {
93 win32_nongcc => 'readline.lib',
94 default => '-lreadline',
97 "_select_lib() returned true value");
102 $step->_select_lib( [
106 win32_nongcc => 'readline.lib',
107 default => '-lreadline',
110 like($@, qr/_select_lib\(\) takes hashref/,
111 "Bad argument to _select_lib correctly detected");
113 pass("Completed all tests in $0");
115 ################### DOCUMENTATION ###################
119 auto/readline-01.t - test auto::readline
123 % prove t/steps/auto/readline-01.t
127 The files in this directory test functionality used by F<Configure.pl>.
129 The tests in this file test auto::readline.
137 config::auto::readline, F<Configure.pl>.
143 # cperl-indent-level: 4
146 # vim: expandtab shiftwidth=4: