Commit | Line | Data |
---|---|---|
1ccdb730 NC |
1 | my @symbols; |
2 | BEGIN { | |
1ccdb730 NC |
3 | require Config; |
4 | if (($Config::Config{'extensions'} !~ /\bB\b/) ){ | |
5 | print "1..0 # Skip -- Perl configured without B module\n"; | |
6 | exit 0; | |
7 | } | |
a5d75221 NC |
8 | if ($Config::Config{'extensions'} !~ /\bFcntl\b/) { |
9 | print "1..0 # Skip -- Perl configured without Fcntl\n"; | |
1ccdb730 NC |
10 | exit 0; |
11 | } | |
a5d75221 | 12 | # S_IFMT is a real subroutine, and acts as control |
1ccdb730 | 13 | # SEEK_SET is a proxy constant subroutine. |
a5d75221 | 14 | @symbols = qw(S_IFMT SEEK_SET); |
eaa79d3d | 15 | require './test.pl'; |
1ccdb730 NC |
16 | } |
17 | ||
18 | use strict; | |
19 | use warnings; | |
eaa79d3d | 20 | plan(4 * @symbols); |
1ccdb730 | 21 | use B qw(svref_2object GVf_IMPORTED_CV); |
a5d75221 | 22 | use Fcntl @symbols; |
1ccdb730 NC |
23 | |
24 | # GVf_IMPORTED_CV should not be set on the original, but should be set on the | |
25 | # imported GV. | |
26 | ||
27 | foreach my $symbol (@symbols) { | |
28 | my ($ps, $ms); | |
29 | { | |
30 | no strict 'refs'; | |
a5d75221 | 31 | $ps = svref_2object(\*{"Fcntl::$symbol"}); |
1ccdb730 NC |
32 | $ms = svref_2object(\*{"::$symbol"}); |
33 | } | |
34 | isa_ok($ps, 'B::GV'); | |
35 | is($ps->GvFLAGS() & GVf_IMPORTED_CV, 0, | |
36 | "GVf_IMPORTED_CV not set on original"); | |
37 | isa_ok($ms, 'B::GV'); | |
38 | is($ms->GvFLAGS() & GVf_IMPORTED_CV, GVf_IMPORTED_CV, | |
39 | "GVf_IMPORTED_CV set on imported GV"); | |
40 | } |