2 # Copyright (C) 2007, Parrot Foundation.
9 use Test::More tests => 9;
11 use lib qw( lib t/configure/testlib );
12 use_ok('config::inter::progs');
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;
19 use IO::CaptureOutput qw| capture |;
21 =for hints_for_testing Testing and refactoring of inter::progs should
22 entail understanding of issues discussed in
23 https://trac.parrot.org/parrot/ticket/854
27 ########## ask; debugging 0 ##########
29 my ($args, $step_list_ref) = process_options(
31 argv => [ q{--ask}, q{--debugging=0} ],
36 my $conf = Parrot::Configure::Step::Test->new;
37 $conf->include_config_results( $args );
39 my $pkg = q{inter::progs};
41 $conf->add_steps($pkg);
43 $conf->options->set( %{$args} );
44 my $step = test_step_constructor_and_description($conf);
48 my ($stdout, $debug, $debug_validity);
63 push @prompts, $conf->data->get($p);
67 $object = tie *STDIN, 'Tie::Filehandle::Preempt::Stdin', @prompts;
68 can_ok( 'Tie::Filehandle::Preempt::Stdin', ('READLINE') );
69 isa_ok( $object, 'Tie::Filehandle::Preempt::Stdin' );
72 my $ask = inter::progs::_prepare_for_interactivity($conf);
74 ($conf, $cc) = inter::progs::_get_programs($conf, $ask);
75 $debug = inter::progs::_get_debug($conf, $ask);
76 $debug_validity = inter::progs::_is_debug_setting_valid($debug);
78 ok( defined $debug_validity, "'debug_validity' set as expected" );
81 $conf = inter::progs::_set_debug_and_warn($conf, $debug);
83 ok( defined $conf, "Components of runstep() tested okay" );
88 pass("Completed all tests in $0");
90 ################### DOCUMENTATION ###################
94 inter/progs-02.t - test inter::progs
98 % prove t/steps/inter/progs-02.t
102 The files in this directory test functionality used by F<Configure.pl>.
104 The tests in this file test inter::progs.
112 config::inter::progs, F<Configure.pl>.
118 # cperl-indent-level: 4
121 # vim: expandtab shiftwidth=4: