summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-12-16 23:03:42 +0000
committerNicholas Clark <nick@ccl4.org>2006-12-16 23:03:42 +0000
commit1ccdb7301362000755034d5e6a7e73f566973104 (patch)
tree0fa142dae37f66fff801c799e2f2d0829fbdec0b /t
parent2e5b91de24d62e1e2bf0fd32a1d4d1d849cafc82 (diff)
downloadperl-1ccdb7301362000755034d5e6a7e73f566973104.tar.gz
Add a new flag SVprv_PCS_IMPORTED (which is a pseudonym for SVf_SCREAM)
to note when a proxy constant subroutine is copied. This allows us to correctly set GvIMPORTED_CV_on() if the symbol is ever turned into a real GV. p4raw-id: //depot/perl@29566
Diffstat (limited to 't')
-rw-r--r--t/lib/proxy_constant_subs.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/lib/proxy_constant_subs.t b/t/lib/proxy_constant_subs.t
new file mode 100644
index 0000000000..4af73d38c4
--- /dev/null
+++ b/t/lib/proxy_constant_subs.t
@@ -0,0 +1,41 @@
+my @symbols;
+BEGIN {
+ chdir 't';
+ @INC = '../lib';
+ require Config;
+ if (($Config::Config{'extensions'} !~ /\bB\b/) ){
+ print "1..0 # Skip -- Perl configured without B module\n";
+ exit 0;
+ }
+ if ($Config::Config{'extensions'} !~ /\bPOSIX\b/) {
+ print "1..0 # Skip -- Perl configured without POSIX\n";
+ exit 0;
+ }
+ # errno is a real subroutine, and acts as control
+ # SEEK_SET is a proxy constant subroutine.
+ @symbols = qw(errno SEEK_SET);
+}
+
+use strict;
+use warnings;
+use Test::More tests => 4 * @symbols;
+use B qw(svref_2object GVf_IMPORTED_CV);
+use POSIX @symbols;
+
+# GVf_IMPORTED_CV should not be set on the original, but should be set on the
+# imported GV.
+
+foreach my $symbol (@symbols) {
+ my ($ps, $ms);
+ {
+ no strict 'refs';
+ $ps = svref_2object(\*{"POSIX::$symbol"});
+ $ms = svref_2object(\*{"::$symbol"});
+ }
+ isa_ok($ps, 'B::GV');
+ is($ps->GvFLAGS() & GVf_IMPORTED_CV, 0,
+ "GVf_IMPORTED_CV not set on original");
+ isa_ok($ms, 'B::GV');
+ is($ms->GvFLAGS() & GVf_IMPORTED_CV, GVf_IMPORTED_CV,
+ "GVf_IMPORTED_CV set on imported GV");
+}