This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor t/lib/proxy_constant_subs.t to use skip_all_without_extension()
[perl5.git] / t / lib / proxy_constant_subs.t
... / ...
CommitLineData
1my @symbols;
2BEGIN {
3 require './test.pl';
4 skip_all_without_extension('B');
5 skip_all_without_extension('Fcntl');
6 # S_IFMT is a real subroutine, and acts as control
7 # SEEK_SET is a proxy constant subroutine.
8 @symbols = qw(S_IFMT SEEK_SET);
9}
10
11use strict;
12use warnings;
13plan(4 * @symbols);
14use B qw(svref_2object GVf_IMPORTED_CV);
15use Fcntl @symbols;
16
17# GVf_IMPORTED_CV should not be set on the original, but should be set on the
18# imported GV.
19
20foreach my $symbol (@symbols) {
21 my ($ps, $ms);
22 {
23 no strict 'refs';
24 $ps = svref_2object(\*{"Fcntl::$symbol"});
25 $ms = svref_2object(\*{"::$symbol"});
26 }
27 isa_ok($ps, 'B::GV');
28 is($ps->GvFLAGS() & GVf_IMPORTED_CV, 0,
29 "GVf_IMPORTED_CV not set on original");
30 isa_ok($ms, 'B::GV');
31 is($ms->GvFLAGS() & GVf_IMPORTED_CV, GVf_IMPORTED_CV,
32 "GVf_IMPORTED_CV set on imported GV");
33}