|
|
Author: jkeenan
Date: Thu Jul 10 16:13:13 2008
New Revision: 29264
Modified:
trunk/t/steps/auto_opengl-03.t
Log:
Add some tests for sub _evaluate_cc_run() and _handle_glut().
Modified: trunk/t/steps/auto_opengl-03.t
==============================================================================
--- trunk/t/steps/auto_opengl-03.t (original)
+++ trunk/t/steps/auto_opengl-03.t Thu Jul 10 16:13:13 2008
@@ -5,7 +5,7 @@
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 23;
use Carp;
use lib qw( lib );
use_ok('config::init::defaults');
@@ -39,27 +39,70 @@
isa_ok( $step, $step_name );
-#my $test = qq{4\n};
-#my $has_glut;
-#{
-# my ($stdout, $stderr);
-# capture(
-# sub { $has_glut = $step->_evaluate_cc_run(
-# $test,
-# $conf->options->get( 'verbose' )
-# ); },
-# \$stdout,
-# \$stderr,
-# );
-# is( $has_glut, 4, "Got expected return value for _evaluate_cc_run()." );
-# is( $step->result(),
-# "yes, GLUT 4", "Got expected result for _evaluate_cc_run()." );
-# like(
-# $stdout,
-# qr/\(yes, GLUT API $has_glut\)/,
-# "Got expected verbose output"
-# );
-#}
+my @try = qw( 4 freeglut );
+my $test = qq{$try[0] $try[1]\n};
+
+{
+ my ($stdout, $stderr);
+ my ($glut_api_version, $glut_brand);
+ capture(
+ sub { ($glut_api_version, $glut_brand) = $step->_evaluate_cc_run(
+ $test,
+ 0,
+ ); },
+ \$stdout,
+ \$stderr,
+ );
+ is( $glut_api_version, $try[0],
+ "Got first expected return value for _evaluate_cc_run()." );
+ is( $glut_brand, $try[1],
+ "Got first expected return value for _evaluate_cc_run()." );
+ ok(! $stdout, "Nothing captured on STDOUT, as expected");
+}
+
+{
+ my ($stdout, $stderr);
+ my ($glut_api_version, $glut_brand);
+ capture(
+ sub { ($glut_api_version, $glut_brand) = $step->_evaluate_cc_run(
+ $test,
+ $conf->options->get( 'verbose' )
+ ); },
+ \$stdout,
+ \$stderr,
+ );
+ is( $glut_api_version, $try[0],
+ "Got first expected return value for _evaluate_cc_run()." );
+ is( $glut_brand, $try[1],
+ "Got first expected return value for _evaluate_cc_run()." );
+ like(
+ $stdout,
+ qr/yes, $glut_brand API version $glut_api_version/,
+ "Got expected verbose output for _evaluate_cc_run()"
+ );
+}
+
+{
+ my $glut_api_version = '4';
+ my $glut_brand = 'freeglut';
+ ok(auto::opengl::_handle_glut( $conf, $glut_api_version, $glut_brand ),
+ "_handle_glut() returned true value");
+ is( $conf->data->get( 'opengl' ), 'define',
+ "Got expected value for opengl");
+ is( $conf->data->get( 'has_opengl' ), 1,
+ "Got expected value for has_opengl");
+ is( $conf->data->get( 'HAS_OPENGL' ), 1,
+ "Got expected value for HAS_OPENGL");
+ is( $conf->data->get( 'glut' ), 'define',
+ "Got expected value for glut");
+ is( $conf->data->get( 'glut_brand' ), $glut_brand,
+ "Got expected value for glut_brand");
+ is( $conf->data->get( 'has_glut' ), $glut_api_version,
+ "Got expected value for has_glut");
+ is( $conf->data->get( 'HAS_GLUT' ), $glut_api_version,
+ "Got expected value for HAS_GLUT");
+
+}
pass("Completed all tests in $0");
|
|