summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-02-25 17:30:10 -0700
committerKarl Williamson <public@khwilliamson.com>2013-08-29 09:55:56 -0600
commitbd70aaaf553eae9630ec958c29bcac4a1a55888c (patch)
treef5996a359a2db45beaedf790bc0de23b21ffe17b /ext
parent33daa3a50a57e3de862a1f030c6b064a95a07217 (diff)
downloadperl-bd70aaaf553eae9630ec958c29bcac4a1a55888c.tar.gz
APItest: Test native code points, instead of Unicode
Diffstat (limited to 'ext')
-rw-r--r--ext/XS-APItest/APItest.xs10
-rw-r--r--ext/XS-APItest/t/utf8.t16
2 files changed, 13 insertions, 13 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 38d4364073..16d26dea33 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -148,8 +148,8 @@ bitflip_key(pTHX_ IV action, SV *field) {
const char *const end = p + len;
while (p < end) {
STRLEN len;
- UV chr = utf8_to_uvuni_buf((U8 *)p, (U8 *) end, &len);
- new_p = (char *)uvuni_to_utf8((U8 *)new_p, chr ^ 32);
+ UV chr = utf8_to_uvchr_buf((U8 *)p, (U8 *) end, &len);
+ new_p = (char *)uvchr_to_utf8((U8 *)new_p, chr ^ 32);
p += len;
}
SvUTF8_on(newkey);
@@ -1151,7 +1151,7 @@ bytes_cmp_utf8(bytes, utf8)
RETVAL
AV *
-test_utf8n_to_uvuni(s, len, flags)
+test_utf8n_to_uvchr(s, len, flags)
SV *s
SV *len
@@ -1162,7 +1162,7 @@ test_utf8n_to_uvuni(s, len, flags)
STRLEN slen;
CODE:
- /* Call utf8n_to_uvuni() with the inputs. It always asks for the
+ /* Call utf8n_to_uvchr() with the inputs. It always asks for the
* actual length to be returned
*
* Length to assume <s> is; not checked, so could have buffer overflow
@@ -1171,7 +1171,7 @@ test_utf8n_to_uvuni(s, len, flags)
sv_2mortal((SV*)RETVAL);
ret
- = utf8n_to_uvuni((U8*) SvPV(s, slen), SvUV(len), &retlen, SvUV(flags));
+ = utf8n_to_uvchr((U8*) SvPV(s, slen), SvUV(len), &retlen, SvUV(flags));
/* Returns the return value in [0]; <retlen> in [1] */
av_push(RETVAL, newSVuv(ret));
diff --git a/ext/XS-APItest/t/utf8.t b/ext/XS-APItest/t/utf8.t
index 8bafd89dab..6a6ed9eaf4 100644
--- a/ext/XS-APItest/t/utf8.t
+++ b/ext/XS-APItest/t/utf8.t
@@ -24,7 +24,7 @@ foreach ([0, '', '', 'empty'],
is(bytes_cmp_utf8($right, $left), -$expect, "$desc reversed");
}
-# Test uft8n_to_uvuni(). These provide essentially complete code coverage.
+# Test uft8n_to_uvchr(). These provide essentially complete code coverage.
# Copied from utf8.h
my $UTF8_ALLOW_EMPTY = 0x0001;
@@ -89,7 +89,7 @@ foreach my $test (
# Test what happens when this malformation is not allowed
undef @warnings;
- my $ret_ref = test_utf8n_to_uvuni($bytes, $length, 0);
+ my $ret_ref = test_utf8n_to_uvchr($bytes, $length, 0);
is($ret_ref->[0], 0, "$testname: disallowed: Returns 0");
is($ret_ref->[1], $expected_len, "$testname: disallowed: Returns expected length");
if (is(scalar @warnings, 1, "$testname: disallowed: Got a single warning ")) {
@@ -104,7 +104,7 @@ foreach my $test (
{ # Next test when disallowed, and warnings are off.
undef @warnings;
no warnings 'utf8';
- my $ret_ref = test_utf8n_to_uvuni($bytes, $length, 0);
+ my $ret_ref = test_utf8n_to_uvchr($bytes, $length, 0);
is($ret_ref->[0], 0, "$testname: disallowed: no warnings 'utf8': Returns 0");
is($ret_ref->[1], $expected_len, "$testname: disallowed: no warnings 'utf8': Returns expected length");
if (!is(scalar @warnings, 0, "$testname: disallowed: no warnings 'utf8': no warnings generated")) {
@@ -114,7 +114,7 @@ foreach my $test (
# Test with CHECK_ONLY
undef @warnings;
- $ret_ref = test_utf8n_to_uvuni($bytes, $length, $UTF8_CHECK_ONLY);
+ $ret_ref = test_utf8n_to_uvchr($bytes, $length, $UTF8_CHECK_ONLY);
is($ret_ref->[0], 0, "$testname: CHECK_ONLY: Returns 0");
is($ret_ref->[1], -1, "$testname: CHECK_ONLY: returns expected length");
if (! is(scalar @warnings, 0, "$testname: CHECK_ONLY: no warnings generated")) {
@@ -125,7 +125,7 @@ foreach my $test (
# Test when the malformation is allowed
undef @warnings;
- $ret_ref = test_utf8n_to_uvuni($bytes, $length, $allow_flags);
+ $ret_ref = test_utf8n_to_uvchr($bytes, $length, $allow_flags);
is($ret_ref->[0], $allowed_uv, "$testname: allowed: Returns expected uv");
is($ret_ref->[1], $expected_len, "$testname: allowed: Returns expected length");
if (!is(scalar @warnings, 0, "$testname: allowed: no warnings generated"))
@@ -224,8 +224,8 @@ foreach my $test (@tests) {
undef @warnings;
my $ret_ref;
- #note __LINE__ . ": $eval_warn; \$ret_ref = test_utf8n_to_uvuni('$bytes', $length, $warn_flag|$disallow_flag)";
- my $eval_text = "$eval_warn; \$ret_ref = test_utf8n_to_uvuni('$bytes', $length, $warn_flag|$disallow_flag)";
+ #note __LINE__ . ": $eval_warn; \$ret_ref = test_utf8n_to_uvchr('$bytes', $length, $warn_flag|$disallow_flag)";
+ my $eval_text = "$eval_warn; \$ret_ref = test_utf8n_to_uvchr('$bytes', $length, $warn_flag|$disallow_flag)";
eval "$eval_text";
if (! ok ("$@ eq ''", "$this_name: eval succeeded")) {
note "\$!='$!'; eval'd=\"$eval_text\"";
@@ -276,7 +276,7 @@ foreach my $test (@tests) {
# $disallow_flag is set
if ($disallowed) {
undef @warnings;
- $ret_ref = test_utf8n_to_uvuni($bytes, $length, $disallow_flag|$UTF8_CHECK_ONLY);
+ $ret_ref = test_utf8n_to_uvchr($bytes, $length, $disallow_flag|$UTF8_CHECK_ONLY);
is($ret_ref->[0], 0, "$this_name, CHECK_ONLY: Returns 0");
is($ret_ref->[1], -1, "$this_name: CHECK_ONLY: returns expected length");
if (! is(scalar @warnings, 0, "$this_name, CHECK_ONLY: no warnings generated")) {