This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Implement SvPVutf8_nomg and SvPVbyte_nomg
[perl5.git] / ext / XS-APItest / t / get.t
CommitLineData
7cfe4f52
FC
1
2# Tests for the get_*v functions.
3
a385812b 4use Test::More tests => 5;
7cfe4f52
FC
5use XS::APItest;
6
7# XXX So far we only test get_cv.
8
9is get_cv("utf8::encode"), \&utf8::encode, 'get_cv(utf8::encode)';
10
11sub foo { " ooof" } # should be stored in the stash as a subref
12die "Test has been sabotaged: sub foo{} should not create a full glob"
13 unless ref $::{foo} eq 'CODE';
14
15my $subref = get_cv("foo");
16is ref $subref, "CODE", 'got a coderef from get_cv("globless sub")';
17is &$subref, " ooof", 'got the right sub';
a385812b
FC
18
19sub bar { "burr" }
20$subref = get_cv_flags("bar",GV_NOADD_NOINIT);
21is ref $subref, "CODE", 'got a coderef from get_cv with GV_NOADD_NOINIT';
22is &$subref, "burr", 'got the right sub';