diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-09-23 12:00:05 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-09-23 12:00:05 +0000 |
commit | 389a661add8b444e2e7cd47a4e7eba4fbc2a980c (patch) | |
tree | 37d3d7d648b3be63aa01b1ef46cbf8e19d682672 /ext/DynaLoader | |
parent | 99df65aa94c2a00e350c2fda1b8e429c45d6ace7 (diff) | |
download | perl-389a661add8b444e2e7cd47a4e7eba4fbc2a980c.tar.gz |
Fix tests for the case of -Du_usedl
p4raw-id: //depot/perl@34404
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r-- | ext/DynaLoader/t/DynaLoader.t | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/ext/DynaLoader/t/DynaLoader.t b/ext/DynaLoader/t/DynaLoader.t index a698a8f19c..28d91e0bfe 100644 --- a/ext/DynaLoader/t/DynaLoader.t +++ b/ext/DynaLoader/t/DynaLoader.t @@ -42,15 +42,23 @@ use_ok( 'DynaLoader' ); # Check functions can_ok( 'DynaLoader' => 'bootstrap' ); # defined in Perl section -can_ok( 'DynaLoader' => 'dl_error' ); # defined in XS section -can_ok( 'DynaLoader' => 'dl_find_symbol' ); # defined in XS section -can_ok( 'DynaLoader' => 'dl_install_xsub' ); # defined in XS section -can_ok( 'DynaLoader' => 'dl_load_file' ); # defined in XS section can_ok( 'DynaLoader' => 'dl_load_flags' ); # defined in Perl section -can_ok( 'DynaLoader' => 'dl_undef_symbols' ); # defined in XS section -SKIP: { - skip "unloading unsupported on $^O", 1 if ($^O eq 'VMS' || $^O eq 'darwin'); - can_ok( 'DynaLoader' => 'dl_unload_file' ); # defined in XS section +can_ok( 'DynaLoader' => 'dl_error' ); # defined in XS section +if ($Config{usedl}) { + can_ok( 'DynaLoader' => 'dl_find_symbol' ); # defined in XS section + can_ok( 'DynaLoader' => 'dl_install_xsub' ); # defined in XS section + can_ok( 'DynaLoader' => 'dl_load_file' ); # defined in XS section + can_ok( 'DynaLoader' => 'dl_undef_symbols' ); # defined in XS section + SKIP: { + skip "unloading unsupported on $^O", 1 if ($^O eq 'VMS' || $^O eq 'darwin'); + can_ok( 'DynaLoader' => 'dl_unload_file' ); # defined in XS section + } +} else { + foreach my $symbol (qw(dl_find_symbol dl_install_sub dl_load_file + dl_undef_symbols dl_unload_file)) { + is(DynaLoader->can($symbol), undef, + "Without dynamic loading, DynaLoader should not have $symbol"); + } } TODO: { @@ -68,16 +76,24 @@ like( $@, q{/^Usage: DynaLoader::bootstrap\(module\)/}, "calling DynaLoader::bootstrap() with no argument" ); eval { package egg_bacon_sausage_and_spam; DynaLoader::bootstrap("egg_bacon_sausage_and_spam") }; -like( $@, q{/^Can't locate loadable object for module egg_bacon_sausage_and_spam/}, +if ($Config{usedl}) { + like( $@, q{/^Can't locate loadable object for module egg_bacon_sausage_and_spam/}, + "calling DynaLoader::bootstrap() with a package without binary object" ); +} else { + like( $@, q{/^Can't load module egg_bacon_sausage_and_spam/}, "calling DynaLoader::bootstrap() with a package without binary object" ); +} # .. for dl_load_file() -eval { DynaLoader::dl_load_file() }; -like( $@, q{/^Usage: DynaLoader::dl_load_file\(filename, flags=0\)/}, - "calling DynaLoader::dl_load_file() with no argument" ); +SKIP: { + skip "no dl_load_file with dl_none.xs", 2 unless $Config{usedl}; + eval { DynaLoader::dl_load_file() }; + like( $@, q{/^Usage: DynaLoader::dl_load_file\(filename, flags=0\)/}, + "calling DynaLoader::dl_load_file() with no argument" ); -eval { no warnings 'uninitialized'; DynaLoader::dl_load_file(undef) }; -is( $@, '', "calling DynaLoader::dl_load_file() with undefined argument" ); # is this expected ? + eval { no warnings 'uninitialized'; DynaLoader::dl_load_file(undef) }; + is( $@, '', "calling DynaLoader::dl_load_file() with undefined argument" ); # is this expected ? +} my ($dlhandle, $dlerr); eval { $dlhandle = DynaLoader::dl_load_file("egg_bacon_sausage_and_spam") }; |