fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / t / steps / gen / opengl-01.t
blob52b6aa89647fcfe9adbecd68e75e523a9874411a
1 #! perl
2 # Copyright (C) 2007-2008, Parrot Foundation.
3 # $Id$
4 # gen/opengl-01.t
6 use strict;
7 use warnings;
8 use Test::More tests =>  20;
9 use Carp;
10 use lib qw( lib );
11 use_ok('config::gen::opengl');
12 use Parrot::Configure::Options qw( process_options );
13 use Parrot::Configure::Step::Test;
14 use Parrot::Configure::Test qw(
15     test_step_constructor_and_description
17 use IO::CaptureOutput qw( capture );
19 ########## regular ##########
21 my ($args, $step_list_ref) = process_options(
22     {
23         argv => [ ],
24         mode => q{configure},
25     }
28 my $conf = Parrot::Configure::Step::Test->new;
29 $conf->include_config_results( $args );
31 my $real_opengl_status = $conf->data->get('has_opengl');
33 my ($pkg, $step, $result);
34 my $serialized = $conf->pcfreeze();
36 $pkg = q{gen::opengl};
37 $conf->add_steps($pkg);
38 $conf->options->set( %{$args} );
39 $step = test_step_constructor_and_description($conf);
41 ##### mock no OpenGL #####
42 $conf->data->set( has_opengl => 0 );
43 $result = $step->runstep($conf);
44 ok($result, "runstep() returned true value");
45 is($step->result(), q{skipped}, "Got expected result when no 'has_opengl'" );
47 SKIP: {
48     skip 'opengl not detected',
49     13 unless $real_opengl_status;
51     # The complex nature of gen::opengl::runstep() makes it difficult to write
52     # tests that will DTRT when OpenGL is not really present on this machine.
53     # In particular, tests for verbose output will fail when
54     # $real_opengl_status is false.  So we'll SKIP.
56     $conf->replenish($serialized);
58     ########### verbose ###########
60     ($args, $step_list_ref) = process_options( {
61         argv => [ q{--verbose} ],
62         mode => q{configure},
63     } );
65     $conf->add_steps($pkg);
66     $conf->options->set( %{$args} );
67     $step = test_step_constructor_and_description($conf);
68     {
69         my ($stdout, $stderr);
70         capture(
71             sub { $result = $step->runstep($conf); },
72             \$stdout,
73             \$stderr,
74         );
75         ok($result, "runstep() returned true value");
76         like( $stdout,
77             qr/Checking for OpenGL headers using the following globs/s,
78             "Got expected verbose output"
79         );
80         like( $stdout,
81             qr/Found the following OpenGL headers/s,
82             "Got expected verbose output"
83         );
84         like( $stdout,
85             qr/PASS\s+FAIL\s+IGNORE\s+HEADER/s,
86             "Got expected verbose output"
87         );
88         like( $stdout,
89             qr/unique signatures successfully translated/s,
90             "Got expected verbose output"
91         );
92     }
94     $conf->replenish($serialized);
96     ########### extra verbose ###########
98     ($args, $step_list_ref) = process_options( {
99         argv => [ q{--verbose=3} ],
100         mode => q{configure},
101     } );
103     $conf->add_steps($pkg);
104     $conf->options->set( %{$args} );
105     $step = test_step_constructor_and_description($conf);
106     {
107         my ($stdout, $stderr);
108         capture(
109             sub { $result = $step->runstep($conf); },
110             \$stdout,
111             \$stderr,
112         );
113         ok($result, "runstep() returned true value");
114         like( $stdout,
115             qr/COUNT\s+NCI SIGNATURE/s,
116             "Got expected verbose output"
117         );
118     }
121 pass("Completed all tests in $0");
123 ################### DOCUMENTATION ###################
125 =head1 NAME
127   gen/opengl-01.t - test gen::opengl
129 =head1 SYNOPSIS
131     % prove t/steps/gen/opengl-01.t
133 =head1 DESCRIPTION
135 The files in this directory test functionality used by F<Configure.pl>.
137 The tests in this file test gen::opengl.
139 =head1 AUTHOR
141 Geoffrey Broadwell; modified from a similar file by James E Keenan.
143 =head1 SEE ALSO
145 config::gen::opengl, F<Configure.pl>.
147 =cut
149 # Local Variables:
150 #   mode: cperl
151 #   cperl-indent-level: 4
152 #   fill-column: 100
153 # End:
154 # vim: expandtab shiftwidth=4: