Skip to content

Commit

Permalink
I can haz tests nao
Browse files Browse the repository at this point in the history
  • Loading branch information
DrHyde committed May 15, 2009
1 parent 961824f commit ddb5e07
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ t/dash-l-libs.t
t/headers.t
t/inc/headerfile.h
VMS-notes
t/coverage.sh
t/cmdline-LIBS-INC.t
80 changes: 80 additions & 0 deletions t/cmdline-LIBS-INC.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
use strict;
# compatible use warnings
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }

use lib 't/lib';
use IO::CaptureOutput qw(capture);
use Config;

use File::Spec;
use Test::More;

my($debug, $stdout, $stderr) = ($ENV{DEVEL_CHECKLIB_DEBUG} || 0);
my $libdir;

eval "use Devel::CheckLib";
if($@ =~ /Couldn't find your C compiler/) { #'
plan skip_all => "Couldn't find your C compiler";
}

eval "use Helper qw(create_testlib)";
if($libdir = create_testlib("bazbam")) {
plan tests => 1;
} else {
plan skip_all => "Couldn't build a library to test against";
};

my $runtime = '-l'.(
$^O eq 'MSWin32' # if Win32 (not Cygwin) ...
? (
$Config{cc} =~ /(^|^\w+ )bcc/
? 'cc3250' # ... Borland
: 'msvcrt' # ... otherwise assume Microsoft
)
: 'm' # default to Unix-style
);

my @args = (qq{LIBS=$runtime});
capture(
sub { system(
$Config{perlpath},
'-Mblib',
'-MDevel::CheckLib',
'-e',
"print @ARGV;assert_lib(debug => $debug)",
@args
)},
\$stdout,
\$stderr
);
is($stderr, q{}, join(', ', @args)) || diag("\tSTDOUT: $stdout\n\tSTDERR: $stderr\n");

@args = map { "LIBS=$_" } ($runtime, '-lbazbam', "-L$libdir");
capture(
sub { system(
$Config{perlpath},
'-Mblib',
'-MDevel::CheckLib',
'-e',
"print @ARGV;assert_lib(debug => $debug)",
@args
)},
\$stdout,
\$stderr
);
is($stderr, q{}, join(', ', @args)) || diag("\tSTDOUT: $stdout\n\tSTDERR: $stderr\n");

@args = (qq{LIBS="$runtime -lbazbam -L$libdir"});
capture(
sub { system(
$Config{perlpath},
'-Mblib',
'-MDevel::CheckLib',
'-e',
"print @ARGV;assert_lib(debug => $debug)",
@args
)},
\$stdout,
\$stderr
);
is($stderr, q{}, join(', ', @args)) || diag("\tSTDOUT: $stdout\n\tSTDERR: $stderr\n");
6 changes: 6 additions & 0 deletions t/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
# $Id: coverage.sh,v 1.1 2008/02/26 21:54:55 drhyde Exp $

cover -delete
HARNESS_PERL_SWITCHES=-MDevel::Cover make test
cover

0 comments on commit ddb5e07

Please sign in to comment.