From: Dan Scott <dscott@laurentian.ca> Date: Thu, 24 Oct 2013 21:44:00 +0000 (-0400) Subject: Test Perl Unicode normalization process X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d475ebc610dfceb11cd34125b5a06c7f530f0ea6;p=evergreen%2Fmasslnc.git Test Perl Unicode normalization process Add some basic tests of our Unicode normalization (and entityization) process. Also, 'use utf8;' tells the script that it contains UTF8 characters, not binary bytes, and resolves a test problem. Signed-off-by: Dan Wells <dbw2@calvin.edu> Signed-off-by: Dan Scott <dscott@laurentian.ca> --- diff --git a/Open-ILS/src/perlmods/t/01-OpenILS-Application.t b/Open-ILS/src/perlmods/t/01-OpenILS-Application.t index a4367f6ca9..6b30fbbe80 100644 --- a/Open-ILS/src/perlmods/t/01-OpenILS-Application.t +++ b/Open-ILS/src/perlmods/t/01-OpenILS-Application.t @@ -1,5 +1,6 @@ #!perl -T +use utf8; use Test::More tests => 14; BEGIN { diff --git a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t index 621c98fdfc..c9de2884a0 100644 --- a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t +++ b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t @@ -1,7 +1,8 @@ #!perl -T -use Test::More tests => 30; +use Test::More tests => 32; use Test::Warn; +use utf8; use_ok( 'OpenILS::Utils::Configure' ); use_ok( 'OpenILS::Utils::Cronscript' ); @@ -86,6 +87,8 @@ my $exp_xml = '<record><leader>01614nmm a22003975u 4500</leader><controlfield ta my $clean_xml = OpenILS::Utils::Normalize::clean_marc($raw_marcxml); is($clean_xml, $exp_xml, "clean_marc: header and space normalization"); +is(OpenILS::Application::AppUtils->entityize('èöçÃÃÃ'), 'èöçÇÈÀ', 'entityize: diacritics NFC'); +is(OpenILS::Application::AppUtils->entityize('èöçÃÃÃ', 'D'), 'èöçÇÈÀ', 'entityize: diacritics NFD'); is(OpenILS::Utils::Normalize::clean_marc('èöçÃÃÃ'), 'èöçÇÈÀ', 'clean_marc: diacritics'); my $edi_invoice = "UNA:+.? 'UNB+UNOC:3+1556150:31B+123EVER:31B+120926:1621+4'UNH+11+INVOIC:D:96A:UN'BGM+380+5TST084026+9'DTM+137:20120924:102'RFF+ON:24'NAD+BY+123EVER 0001::91'NAD+SU+1691503::31B'CUX+2:USD:4'LIN+1++9780446360272'QTY+47:5'MOA+146:4.5:USD:10'MOA+203:14.65'PRI+AAF:2.93:DI:NTP'RFF+LI:24/102'LIN+2++9780446357197'QTY+47:8'MOA+146:6.5:USD:10'MOA+203:33.84'PRI+AAF:4.23:DI:NTP'RFF+LI:24/100'UNS+S'MOA+86:66.18'ALC+C++++DL'MOA+8:2'ALC+C++++CA'MOA+131:12.3'ALC+C++++TX'MOA+8:3.39'UNT+28+11'UNH+12+INVOIC:D:96A:UN'BGM+380+5TST084027+9'DTM+137:20120924:102'RFF+ON:26'NAD+BY+123EVER 0001::91'NAD+SU+1691503::31B'CUX+2:USD:4'LIN+1++9780446360272'QTY+47:1'MOA+146:4.5:USD:10'MOA+203:4.05'PRI+AAF:4.05:DI:NTP'RFF+LI:26/106'LIN+2++9780446350105'QTY+47:3'MOA+146:6.99:USD:10'MOA+203:14.67'PRI+AAF:4.89:DI:NTP'RFF+LI:26/105'UNS+S'MOA+86:25.03'ALC+C++++DL'MOA+8:2'ALC+C++++CA'MOA+131:3'ALC+C++++TX'MOA+8:1.31'UNT+28+12'UNZ+4+4'";