diff options
author | Karl Williamson <khw@cpan.org> | 2020-05-29 08:51:46 -0600 |
---|---|---|
committer | Sawyer X <xsawyerx@cpan.org> | 2020-06-07 09:50:00 +0300 |
commit | 63c69d8307a22a38d9f93571e88625f3261e2618 (patch) | |
tree | 067be1be2fb74991ec094f95e14b930fc40c4825 | |
parent | df812ad2f218bde737f935e42c3b63369e53495e (diff) | |
download | perl-63c69d8307a22a38d9f93571e88625f3261e2618.tar.gz |
APItest/t/svpv.t: Generalize for EBCDIC
This had ASCII-centric tests, which have now been converted to work on
EBCDIC as well.
-rw-r--r-- | ext/XS-APItest/t/svpv.t | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ext/XS-APItest/t/svpv.t b/ext/XS-APItest/t/svpv.t index 4a27d29729..09159bcc0f 100644 --- a/ext/XS-APItest/t/svpv.t +++ b/ext/XS-APItest/t/svpv.t @@ -1,5 +1,7 @@ #!perl -w +BEGIN { require 'charset_tools.pl'; } + use Test::More tests => 35; use XS::APItest; @@ -18,29 +20,33 @@ for my $func ('SvPVbyte', 'SvPVutf8') { is ref\$^V, 'REF', "$func(\$ro_ref) does not flatten the ref"; } -my $data_bin = "\xC4\x8D"; +my $B6 = byte_utf8a_to_utf8n("\xC2\xB6"); +my $individual_B6_utf8_bytes = ($::IS_ASCII) + ? "\xC3\x82\xC2\xB6" + : I8_to_native("\xC6\xB8\xC6\xA1"); +my $data_bin = $B6; utf8::downgrade($data_bin); tie my $scalar_bin, 'TieScalarCounter', $data_bin; do { my $fetch = $scalar_bin }; is tied($scalar_bin)->{fetch}, 1; is tied($scalar_bin)->{store}, 0; -is SvPVutf8_nomg($scalar_bin), "\xC3\x84\xC2\x8D"; +is SvPVutf8_nomg($scalar_bin), $individual_B6_utf8_bytes; is tied($scalar_bin)->{fetch}, 1; is tied($scalar_bin)->{store}, 0; -is SvPVbyte_nomg($scalar_bin), "\xC4\x8D"; +is SvPVbyte_nomg($scalar_bin), $B6; is tied($scalar_bin)->{fetch}, 1; is tied($scalar_bin)->{store}, 0; -my $data_uni = "\xC4\x8D"; +my $data_uni = $B6; utf8::upgrade($data_uni); tie my $scalar_uni, 'TieScalarCounter', $data_uni; do { my $fetch = $scalar_uni }; is tied($scalar_uni)->{fetch}, 1; is tied($scalar_uni)->{store}, 0; -is SvPVbyte_nomg($scalar_uni), "\xC4\x8D"; +is SvPVbyte_nomg($scalar_uni), $B6; is tied($scalar_uni)->{fetch}, 1; is tied($scalar_uni)->{store}, 0; -is SvPVutf8_nomg($scalar_uni), "\xC3\x84\xC2\x8D"; +is SvPVutf8_nomg($scalar_uni), $individual_B6_utf8_bytes; is tied($scalar_uni)->{fetch}, 1; is tied($scalar_uni)->{store}, 0; |