diff options
Diffstat (limited to 'ext/XS-APItest/t/newCONSTSUB.t')
-rw-r--r-- | ext/XS-APItest/t/newCONSTSUB.t | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/XS-APItest/t/newCONSTSUB.t b/ext/XS-APItest/t/newCONSTSUB.t new file mode 100644 index 0000000000..4a2edd62ab --- /dev/null +++ b/ext/XS-APItest/t/newCONSTSUB.t @@ -0,0 +1,24 @@ +#!perl + +use strict; +use warnings; +use utf8; +use open qw( :utf8 :std ); +use Test::More "no_plan"; + +use XS::APItest; + +my ($const, $glob) = XS::APItest::newCONSTSUB_type(\%::, "sanity_check", 0, 0); + +ok $const; +ok *{$glob}{CODE}; + +($const, $glob) = XS::APItest::newCONSTSUB_type(\%::, "\x{30cb}", 0, 0); +ok $const, "newCONSTSUB generates the constant,"; +ok *{$glob}{CODE}, "..and the glob,"; +ok !$::{"\x{30cb}"}, "...but not the right one"; + +($const, $glob) = XS::APItest::newCONSTSUB_type(\%::, "\x{30cd}", 0, 1); +ok $const, "newCONSTSUB_flags generates the constant,"; +ok *{$glob}{CODE}, "..and the glob,"; +ok $::{"\x{30cd}"}, "...the right one!"; |