bring Test::Harness up to 3.06
[p5sagit/p5-mst-13.2.git] / t / lib / proxy_constant_subs.t
CommitLineData
1ccdb730 1my @symbols;
2BEGIN {
3 chdir 't';
4 @INC = '../lib';
5 require Config;
6 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
7 print "1..0 # Skip -- Perl configured without B module\n";
8 exit 0;
9 }
10 if ($Config::Config{'extensions'} !~ /\bPOSIX\b/) {
11 print "1..0 # Skip -- Perl configured without POSIX\n";
12 exit 0;
13 }
14 # errno is a real subroutine, and acts as control
15 # SEEK_SET is a proxy constant subroutine.
16 @symbols = qw(errno SEEK_SET);
17}
18
19use strict;
20use warnings;
21use Test::More tests => 4 * @symbols;
22use B qw(svref_2object GVf_IMPORTED_CV);
23use POSIX @symbols;
24
25# GVf_IMPORTED_CV should not be set on the original, but should be set on the
26# imported GV.
27
28foreach my $symbol (@symbols) {
29 my ($ps, $ms);
30 {
31 no strict 'refs';
32 $ps = svref_2object(\*{"POSIX::$symbol"});
33 $ms = svref_2object(\*{"::$symbol"});
34 }
35 isa_ok($ps, 'B::GV');
36 is($ps->GvFLAGS() & GVf_IMPORTED_CV, 0,
37 "GVf_IMPORTED_CV not set on original");
38 isa_ok($ms, 'B::GV');
39 is($ms->GvFLAGS() & GVf_IMPORTED_CV, GVf_IMPORTED_CV,
40 "GVf_IMPORTED_CV set on imported GV");
41}