diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-13 21:06:29 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-11 10:12:19 +0200 |
commit | 406700cc2c30076030b511780fa9f662c8bfec20 (patch) | |
tree | 66bba96acff6777ccc2173c112256b467fe52fbb /ext | |
parent | b7b5e5787c7b4801f734eb833f5850eea594cca9 (diff) | |
download | perl-406700cc2c30076030b511780fa9f662c8bfec20.tar.gz |
Tests for Perl_get_vtbl()
Diffstat (limited to 'ext')
-rw-r--r-- | ext/XS-APItest/APItest.xs | 47 | ||||
-rw-r--r-- | ext/XS-APItest/t/magic.t | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index b9f4a67909..3ddf8d10e7 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -2819,3 +2819,50 @@ ALIAS: sv_unmagic_bar = 1 CODE: sv_unmagicext(SvRV(sv), PERL_MAGIC_ext, ix ? &vtbl_bar : &vtbl_foo); + +UV +test_get_vtbl() + PREINIT: + MGVTBL *have; + MGVTBL *want; + CODE: +#define test_get_this_vtable(name) \ + want = CAT2(&PL_vtbl_, name); \ + have = get_vtbl(CAT2(want_vtbl_, name)); \ + if (have != want) \ + croak("fail %p!=%p for get_vtbl(want_vtbl_" STRINGIFY(name) ") at " __FILE__ " line %d", have, want, __LINE__) + + test_get_this_vtable(sv); + test_get_this_vtable(env); + test_get_this_vtable(envelem); + test_get_this_vtable(sigelem); + test_get_this_vtable(pack); + test_get_this_vtable(packelem); + test_get_this_vtable(dbline); + test_get_this_vtable(isa); + test_get_this_vtable(isaelem); + test_get_this_vtable(arylen); + test_get_this_vtable(mglob); + test_get_this_vtable(nkeys); + test_get_this_vtable(taint); + test_get_this_vtable(substr); + test_get_this_vtable(vec); + test_get_this_vtable(pos); + test_get_this_vtable(bm); + test_get_this_vtable(fm); + test_get_this_vtable(uvar); + test_get_this_vtable(defelem); + test_get_this_vtable(regexp); + test_get_this_vtable(regdata); + test_get_this_vtable(regdatum); +#ifdef USE_LOCALE_COLLATE + test_get_this_vtable(collxfrm); +#endif + test_get_this_vtable(amagic); + test_get_this_vtable(amagicelem); + test_get_this_vtable(backref); + test_get_this_vtable(utf8); + + RETVAL = PTR2UV(get_vtbl(-1)); + OUTPUT: + RETVAL diff --git a/ext/XS-APItest/t/magic.t b/ext/XS-APItest/t/magic.t index 9dfb7c1b79..8451f0196a 100644 --- a/ext/XS-APItest/t/magic.t +++ b/ext/XS-APItest/t/magic.t @@ -27,4 +27,6 @@ sv_unmagic_bar($sv); ok !mg_find_foo($sv), 'foo magic still removed'; ok !mg_find_bar($sv), '... and bar magic is removed too'; +is(test_get_vtbl(), 0, 'get_vtbl(-1) returns NULL'); + done_testing; |