tagged release 0.6.4
[parrot.git] / t / steps / auto_icu-03.t
blob487ff09e6beee47437b6786a9819b4de840fb571
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # auto_icu-03.t
6 use strict;
7 use warnings;
8 use Test::More;
9 use Carp;
10 use lib qw( lib t/configure/testlib );
11 use Parrot::Configure;
12 use Parrot::Configure::Options qw( process_options );
13 use Parrot::Configure::Test qw( test_step_thru_runstep);
14 use Parrot::Configure::Utils qw( capture_output );
16     my ($stdout, $stderr, $ret);
17     eval { ($stdout, $stderr, $ret) =
18         capture_output( qw| icu-config --exists | ); };
19     if ($stderr) {
20         plan skip_all => "icu-config not available";
21     }
22     else {
23         plan tests => 13;
24     }
26 use_ok('config::init::defaults');
27 use_ok('config::auto::icu');
28 use IO::CaptureOutput qw( capture );
30 my $args = process_options(
31     {
32         argv => [
33             q{--icu-config=1},
34             q{--icuheaders=alpha},
35             q{--icushared=beta}
36         ],
37         mode => q{configure},
38     }
41 my $conf = Parrot::Configure->new;
43 test_step_thru_runstep( $conf, q{init::defaults}, $args );
45 my $pkg = q{auto::icu};
47 $conf->add_steps($pkg);
48 $conf->options->set( %{$args} );
50 my ( $task, $step_name, $step);
51 $task        = $conf->steps->[-1];
52 $step_name   = $task->step;
54 $step = $step_name->new();
55 ok( defined $step, "$step_name constructor returned defined value" );
56 isa_ok( $step, $step_name );
57 ok( $step->description(), "$step_name has description" );
60     my ($stdout, $stderr, $ret);
61     capture(
62         sub { $ret = $step->runstep($conf); },
63         \$stdout,
64         \$stderr,
65     );
66     ok(! defined $ret, "runstep() returned undefined value as expected");
67     like($stderr, qr/error: icuheaders not defined or invalid/s,
68         "Got expected warnings");
69     like($stderr, qr/Something is wrong with your ICU installation/s,
70         "Got expected warnings");
73 pass("Completed all tests in $0");
75 ################### DOCUMENTATION ###################
77 =head1 NAME
79 auto_icu-03.t - test config::auto::icu
81 =head1 SYNOPSIS
83     % prove t/steps/auto_icu-03.t
85 =head1 DESCRIPTION
87 The files in this directory test functionality used by F<Configure.pl>.
89 The tests in this file test config::auto::icu with command-line options
90 C<--icushared> and C<--icuheaders>.
92 =head1 AUTHOR
94 James E Keenan
96 =head1 SEE ALSO
98 config::auto::icu, F<Configure.pl>.
100 =cut
102 # Local Variables:
103 #   mode: cperl
104 #   cperl-indent-level: 4
105 #   fill-column: 100
106 # End:
107 # vim: expandtab shiftwidth=4: