bug 5301: improve escaping of XML characters in bib output
[koha_ffzg] / t / Koha.t
index c06a406..a042f47 100755 (executable)
--- a/t/Koha.t
+++ b/t/Koha.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More tests => 5;
 
 use_ok('C4::Koha');
 
@@ -13,3 +13,9 @@ my $date = "01/01/2002";
 my $newdate = &slashifyDate("2002-01-01");
 
 ok($date eq $newdate, 'slashifyDate');
+
+my $undef = undef;
+is(xml_escape($undef), '', 'xml_escape() returns empty string on undef input');
+my $str = q{'"&<>'};
+is(xml_escape($str), '&apos;&quot;&amp;&lt;&gt;&apos;', 'xml_escape() works as expected');
+is($str, q{'"&<>'}, '... and does not change input in place');