tagged release 0.6.4
[parrot.git] / t / steps / inter_charset-02.t
blobb8e5049386191ac3d0a56f1b2c784325e2857788
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # inter_charset-02.t
6 use strict;
7 use warnings;
8 use Test::More tests =>  12;
9 use Carp;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 $ENV{TEST_CHARSET} = 'ascii.c';
13 use_ok('config::inter::charset');
14 use Parrot::Configure;
15 use Parrot::Configure::Options qw( process_options );
16 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 use Tie::Filehandle::Preempt::Stdin;
19 my $args = process_options(
20     {
21         argv => [ q{--ask} ],
22         mode => q{configure},
23     }
26 my $conf = Parrot::Configure->new;
28 test_step_thru_runstep( $conf, q{init::defaults}, $args );
30 my $pkg = q{inter::charset};
32 $conf->add_steps($pkg);
33 $conf->options->set( %{$args} );
35 my ( $task, $step_name, $step);
36 $task        = $conf->steps->[-1];
37 $step_name   = $task->step;
39 $step = $step_name->new();
40 ok( defined $step, "$step_name constructor returned defined value" );
41 isa_ok( $step, $step_name );
44 my ( @prompts, $prompt, $object );
46 $prompt = $ENV{TEST_CHARSET};
47 push @prompts, $prompt;
49 $object = tie *STDIN, 'Tie::Filehandle::Preempt::Stdin', @prompts;
50 can_ok( 'Tie::Filehandle::Preempt::Stdin', ('READLINE') );
51 isa_ok( $object, 'Tie::Filehandle::Preempt::Stdin' );
54     open STDOUT, '>', "/dev/null" or croak "Unable to open to myout";
55     my $ret = $step->runstep($conf);
56     close STDOUT or croak "Unable to close after myout";
57     ok( $ret, "$step_name runstep() returned true value" );
60 undef $object;
61 untie *STDIN;
63 pass("Completed all tests in $0");
65 ################### DOCUMENTATION ###################
67 =head1 NAME
69 inter_charset-02.t - test config::inter::charset
71 =head1 SYNOPSIS
73     % prove t/steps/inter_charset-02.t
75 =head1 DESCRIPTION
77 The files in this directory test functionality used by F<Configure.pl>.
79 The tests in this file test subroutines exported by config::inter::charset.
81 =head1 AUTHOR
83 James E Keenan
85 =head1 SEE ALSO
87 config::inter::charset, F<Configure.pl>.
89 =cut
91 # Local Variables:
92 #   mode: cperl
93 #   cperl-indent-level: 4
94 #   fill-column: 100
95 # End:
96 # vim: expandtab shiftwidth=4: