2 # Copyright (C) 2007, The Perl Foundation.
8 use Test::More tests => 14;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::inter::yacc');
13 use Parrot::Configure;
14 use Parrot::Configure::Options qw( process_options );
15 use Parrot::Configure::Test qw( test_step_thru_runstep);
16 use Tie::Filehandle::Preempt::Stdin;
18 my $args = process_options(
20 argv => [ q{--ask}, q{--maintainer}, q{--yacc=bison} ],
25 my $conf = Parrot::Configure->new();
27 test_step_thru_runstep( $conf, q{init::defaults}, $args );
29 my ( $task, $step_name, $step, $ret );
30 my $pkg = q{inter::yacc};
32 $conf->add_steps($pkg);
33 $conf->options->set( %{$args} );
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 );
41 ok( $step->description(), "$step_name has description" );
43 my ( @prompts, $object );
44 @prompts = map { q{foo_} . $_ } qw| alpha |;
45 $object = tie *STDIN, 'Tie::Filehandle::Preempt::Stdin', @prompts;
46 can_ok( 'Tie::Filehandle::Preempt::Stdin', ('READLINE') );
47 isa_ok( $object, 'Tie::Filehandle::Preempt::Stdin' );
49 $ret = $step->runstep($conf);
50 ok( defined $ret, "$step_name runstep() returned defined value" );
51 my $result_expected = q{user defined};
52 is( $step->result(), $result_expected, "Result was $result_expected" );
57 pass("Completed all tests in $0");
59 ################### DOCUMENTATION ###################
63 inter_yacc-04.t - test config::inter::yacc
67 % prove t/steps/inter_yacc-04.t
71 The files in this directory test functionality used by F<Configure.pl>.
73 The tests in this file test subroutines exported by config::inter::yacc. In
74 this test the C<--ask>, C<--maintainer> and C<--yacc> options are
83 config::inter::yacc, F<Configure.pl>.
89 # cperl-indent-level: 4
92 # vim: expandtab shiftwidth=4: