Debian Codegraph @

ext/XS-APItest/t/svsetsv.t

raw
1 use strict;
2 use warnings;
3
4 use Test::More tests => 7;
5
6 BEGIN { use_ok('XS::APItest') };
7
8 # I can't see a good way to easily get back perl-space diagnostics for these
9 # I hope that this isn't a problem.
10 ok(sv_setsv_cow_hashkey_core,
11 "With PERL_CORE sv_setsv does COW for shared hash key scalars");
12
13 ok(!sv_setsv_cow_hashkey_notcore,
14 "Without PERL_CORE sv_setsv doesn't COW for shared hash key scalars");
15
16 *AUTOLOAD = \&XS::APItest::AutoLoader::AUTOLOADp;
17 foo(\1); sv_set_deref(\&AUTOLOAD, '$', 0);
18 is prototype(\&AUTOLOAD), '$', 'sv_setsv(cv,...) sets prototype';
19 foo(\1); sv_set_deref(\&AUTOLOAD, '$', 1);
20 is prototype(\&AUTOLOAD), '$', 'sv_setpv(cv,...) sets prototype';
21 foo(\1); sv_set_deref(\&AUTOLOAD, '$', 2);
22 is prototype(\&AUTOLOAD), '$', 'sv_setpvn(cv,...) sets prototype';
23
24 # Perhaps this does not belong here? But it is at least testing that
25 # sv_mortalcopy uses sv_setsv in an unsurprising way.
26 ok !SvIsCOW(sv_mortalcopy(__PACKAGE__)),
27 'sv_mortalcopy does not COW for extensions [perl #79824]';