2 # Tests for the get_*v functions.
4 use Test::More tests => 5;
7 # XXX So far we only test get_cv.
9 is get_cv("utf8::encode"), \&utf8::encode, 'get_cv(utf8::encode)';
11 sub foo { " ooof" } # should be stored in the stash as a subref
12 die "Test has been sabotaged: sub foo{} should not create a full glob"
13 unless ref $::{foo} eq 'CODE';
15 my $subref = get_cv("foo");
16 is ref $subref, "CODE", 'got a coderef from get_cv("globless sub")';
17 is &$subref, " ooof", 'got the right sub';
20 $subref = get_cv_flags("bar",GV_NOADD_NOINIT);
21 is ref $subref, "CODE", 'got a coderef from get_cv with GV_NOADD_NOINIT';
22 is &$subref, "burr", 'got the right sub';