diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-08 15:55:08 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-08 16:58:10 +0100 |
commit | 88c4b02d8afbe13e65dd6f677f5056354ec301cb (patch) | |
tree | 5eb8e18756391447a4d6994541fe8de0e012ef2f | |
parent | 2ccd9aae61c3a09fcad5c90b7b21eb45c9e640ae (diff) | |
download | perl-88c4b02d8afbe13e65dd6f677f5056354ec301cb.tar.gz |
XS::APItest tests for XS_APIVERSION_BOOTCHECK.
-rw-r--r-- | ext/XS-APItest/APItest.xs | 8 | ||||
-rw-r--r-- | ext/XS-APItest/XSUB-redefined-macros.xs | 8 | ||||
-rw-r--r-- | ext/XS-APItest/t/xsub_h.t | 6 |
3 files changed, 22 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 7b3b10cf37..b59aff45d9 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -607,6 +607,7 @@ static int my_keyword_plugin(pTHX_ XS(XS_XS__APItest__XSUB_XS_VERSION_undef); XS(XS_XS__APItest__XSUB_XS_VERSION_empty); +XS(XS_XS__APItest__XSUB_XS_APIVERSION_invalid); #include "const-c.inc" @@ -621,6 +622,7 @@ MODULE = XS::APItest PACKAGE = XS::APItest::XSUB BOOT: newXS("XS::APItest::XSUB::XS_VERSION_undef", XS_XS__APItest__XSUB_XS_VERSION_undef, __FILE__); newXS("XS::APItest::XSUB::XS_VERSION_empty", XS_XS__APItest__XSUB_XS_VERSION_empty, __FILE__); + newXS("XS::APItest::XSUB::XS_APIVERSION_invalid", XS_XS__APItest__XSUB_XS_APIVERSION_invalid, __FILE__); void XS_VERSION_defined(...) @@ -628,6 +630,12 @@ XS_VERSION_defined(...) XS_VERSION_BOOTCHECK; XSRETURN_EMPTY; +void +XS_APIVERSION_valid(...) + PPCODE: + XS_APIVERSION_BOOTCHECK; + XSRETURN_EMPTY; + MODULE = XS::APItest:Hash PACKAGE = XS::APItest::Hash void diff --git a/ext/XS-APItest/XSUB-redefined-macros.xs b/ext/XS-APItest/XSUB-redefined-macros.xs index afbe6741fa..05cfb41978 100644 --- a/ext/XS-APItest/XSUB-redefined-macros.xs +++ b/ext/XS-APItest/XSUB-redefined-macros.xs @@ -5,6 +5,8 @@ #undef XS_VERSION #define XS_VERSION "" +#undef PERL_API_VERSION_STRING +#define PERL_API_VERSION_STRING "1.0.16" #include "XSUB.h" /* This can't be "MODULE = XS::APItest" as then we get duplicate bootstraps. */ @@ -17,3 +19,9 @@ XS_VERSION_empty(...) PPCODE: XS_VERSION_BOOTCHECK; XSRETURN_EMPTY; + +void +XS_APIVERSION_invalid(...) + PPCODE: + XS_APIVERSION_BOOTCHECK; + XSRETURN_EMPTY; diff --git a/ext/XS-APItest/t/xsub_h.t b/ext/XS-APItest/t/xsub_h.t index 8735552152..93742b1ba8 100644 --- a/ext/XS-APItest/t/xsub_h.t +++ b/ext/XS-APItest/t/xsub_h.t @@ -114,4 +114,10 @@ foreach $XS_VERSION (undef, @versions) { is ($count, 0, "no objects exist"); } +is_deeply([XS_APIVERSION_valid("Pie")], [], "XS_APIVERSION_BOOTCHECK passes"); +is(eval {XS_APIVERSION_invalid("Pie"); 1}, undef, + "XS_APIVERSION_BOOTCHECK croaks for an invalid version"); +like($@, qr/Perl API version v1.0.16 of Pie does not match v5\.\d+\.\d+/, + "expected error"); + done_testing(); |