2 # Copyright (C) 2007, Parrot Foundation.
8 use Test::More tests => 13;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::inter::make');
12 use Parrot::Configure;
13 use Parrot::Configure::Options qw( process_options );
14 use Parrot::Configure::Step::Test;
15 use Parrot::Configure::Test qw(
16 test_step_constructor_and_description
18 use Tie::Filehandle::Preempt::Stdin;
20 ########## ask ##########
22 my ($args, $step_list_ref) = process_options(
29 my $conf = Parrot::Configure::Step::Test->new;
30 $conf->include_config_results( $args );
32 my $pkg = q{inter::make};
34 $conf->add_steps($pkg);
36 my $serialized = $conf->pcfreeze();
38 $conf->options->set( %{$args} );
39 my $step = test_step_constructor_and_description($conf);
41 my ( @prompts, $object );
43 $object = tie *STDIN, 'Tie::Filehandle::Preempt::Stdin', @prompts;
44 can_ok( 'Tie::Filehandle::Preempt::Stdin', ('READLINE') );
45 isa_ok( $object, 'Tie::Filehandle::Preempt::Stdin' );
47 my $ret = $step->runstep($conf);
48 ok( defined $ret, "runstep() returned defined value" );
53 $conf->replenish($serialized);
55 ########## ask ##########
57 ($args, $step_list_ref) = process_options(
64 $conf->options->set( %{$args} );
65 $step = test_step_constructor_and_description($conf);
67 $conf->data->set('gmake_version' => '4.1');
69 inter::make::_set_make_c($conf, $prog);
70 is($conf->data->get('make_c'), 'gmake -C',
71 "make_c correctly set when gmake");
73 $conf->data->set('gmake_version' => undef);
74 my $str = q|$(PERL) -e 'chdir shift @ARGV; system q{$(MAKE)}, @ARGV; exit $$? >> 8;'|;
75 $conf->data->set(make_c => $str);
77 inter::make::_set_make_c($conf, $prog);
78 is($conf->data->get('make_c'),
79 q|$(PERL) -e 'chdir shift @ARGV; system q{make}, @ARGV; exit $$? >> 8;'|,
80 "make_c correctly set when gmake");
82 pass("Completed all tests in $0");
84 ################### DOCUMENTATION ###################
88 inter/make-01.t - test inter::make
92 % prove t/steps/inter/make-01.t
96 The files in this directory test functionality used by F<Configure.pl>.
98 The tests in this file test inter::make.
100 B<Note:> Since F<inter::make> probes for the F<make> program
101 found on a particular OS, it will probably be difficult to achieve high
102 branch or condition coverage. The module is likely to discover a
103 F<make> program long before it reaches the point where it must prompt
104 the user for a response.
112 config::inter::make, F<Configure.pl>.
118 # cperl-indent-level: 4
121 # vim: expandtab shiftwidth=4: