From: Jerry D. Hedden Date: Wed, 4 Apr 2007 09:57:16 +0000 (-0400) Subject: Allow any *DBM_File to work for DynaLoader testing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=494364e0465f3123bb285c25f7aea65e01c763c4;p=p5sagit%2Fp5-mst-13.2.git Allow any *DBM_File to work for DynaLoader testing From: "Jerry D. Hedden" Message-ID: <1ff86f510704040657t732af552jbcbdb8804d134ff7@mail.gmail.com> p4raw-id: //depot/perl@30852 --- diff --git a/ext/DynaLoader/t/DynaLoader.t b/ext/DynaLoader/t/DynaLoader.t index 619887c..3d74bc7 100644 --- a/ext/DynaLoader/t/DynaLoader.t +++ b/ext/DynaLoader/t/DynaLoader.t @@ -12,11 +12,22 @@ use Config; use Test::More; my %modules; +my $db_file; +BEGIN { + use Config; + foreach (qw/SDBM_File GDBM_File ODBM_File NDBM_File DB_File/) { + if ($Config{extensions} =~ /\b$_\b/) { + $db_file = $_; + last; + } + } +} + %modules = ( # ModuleName => q| code to check that it was loaded |, 'Cwd' => q| ::is( ref Cwd->can('fastcwd'),'CODE' ) |, # 5.7 ? 'File::Glob' => q| ::is( ref File::Glob->can('doglob'),'CODE' ) |, # 5.6 - 'SDBM_File' => q| ::is( ref SDBM_File->can('TIEHASH'), 'CODE' ) |, # 5.0 + $db_file => q| ::is( ref $db_file->can('TIEHASH'), 'CODE' ) |, # 5.0 'Socket' => q| ::is( ref Socket->can('inet_aton'),'CODE' ) |, # 5.0 'Time::HiRes'=> q| ::is( ref Time::HiRes->can('usleep'),'CODE' ) |, # 5.7.3 ); diff --git a/ext/DynaLoader/t/XSLoader.t b/ext/DynaLoader/t/XSLoader.t index 82dca56..e35c4ee 100644 --- a/ext/DynaLoader/t/XSLoader.t +++ b/ext/DynaLoader/t/XSLoader.t @@ -10,12 +10,21 @@ BEGIN { use strict; use Config; +my $db_file; BEGIN { eval "use Test::More"; if ($@) { print "1..0 # Skip: Test::More not available\n"; die "Test::More not available\n"; } + + use Config; + foreach (qw/SDBM_File GDBM_File ODBM_File NDBM_File DB_File/) { + if ($Config{extensions} =~ /\b$_\b/) { + $db_file = $_; + last; + } + } } @@ -23,7 +32,7 @@ my %modules = ( # ModuleName => q|code to check that it was loaded|, 'Cwd' => q| ::can_ok( 'Cwd' => 'fastcwd' ) |, # 5.7 ? 'File::Glob' => q| ::can_ok( 'File::Glob' => 'doglob' ) |, # 5.6 - 'SDBM_File' => q| ::can_ok( 'SDBM_File' => 'TIEHASH' ) |, # 5.0 + $db_file => q| ::can_ok( $db_file => 'TIEHASH' ) |, # 5.0 'Socket' => q| ::can_ok( 'Socket' => 'inet_aton' ) |, # 5.0 'Time::HiRes'=> q| ::can_ok( 'Time::HiRes' => 'usleep' ) |, # 5.7.3 );