From 4574035ec43cabf050a7ab036bbba1cd2447a18f Mon Sep 17 00:00:00 2001
From: Urban Müller
Date: Thu, 22 Mar 2012 18:48:52 +0000
Subject: check encoding in Q() and _tag(), adapt tests to utf-8
---
tests/it_html.t | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
(limited to 'tests/it_html.t')
diff --git a/tests/it_html.t b/tests/it_html.t
index 0def431..c955359 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -4,6 +4,7 @@
# Tests for html.class
# Traditional html generation
+ini_set('default_charset', "utf-8");
new it_html(array('htmltype' => "html"));
is(
@@ -95,30 +96,22 @@ is(
'),
- ' swisspics posted < < & yesterday a photo tag missmatch:
',
+ ' swisspics posted < < ä & yesterday a photo tag missmatch:
',
'it_html::sanitize tag soup'
);
is(
it_html::sanitize('q←x'),
- "q←x",
+ "q←x",
'it_html::sanitize preserve numeric entities'
);
-it_html::configure(array('charset' => "utf-8"));
is(
it_html::sanitize('qüx'),
"q\xc3\xbcx",
'it_html::sanitize with utf-8'
);
-it_html::configure(array('charset' => "iso-8859-1"));
-is(
- it_html::sanitize('qüx'),
- "q\xfcx",
- 'it_html::sanitize with latin1'
-);
-
is(
it_html::sanitize('a
b'),
"a
b",
@@ -126,8 +119,8 @@ is(
);
is(
- U("/foo.html", array('bar' => array('gna' => 42, 'qux' => array('quux' => "", 'gnp' => "fasel")))),
- '/foo.html?bar[gna]=42&bar[qux][quux]=%3CZ%FCrich%3E&bar[qux][gn%F6p]=fasel',
+ U("/foo.html", array('bar' => array('gna' => 42, 'qux' => array('quux' => "", 'gnöp' => "fasel")))),
+ '/foo.html?bar[gna]=42&bar[qux][quux]=%3CZ%C3%BCrich%3E&bar[qux][gn%C3%B6p]=fasel',
'U() with nested arrays'
);
@@ -149,11 +142,30 @@ is(
'U() converting of \ to /'
);
-is(it_html::entity_decode("ä"), "");
-is(it_html::entity_decode("’"), "'");
+is(it_html::entity_decode("ä"), "ä");
is(it_html::entity_decode("J"), "J");
is(it_html::entity_decode("J"), "J");
-is(it_html::entity_decode(""), " ");
is(it_html::entity_decode("A"), "A");
+
+
+#
+# check transliterations in iso-8859-1
+#
+
+it_html::configure(array('charset' => "iso-8859-1"));
+
+is(
+ it_html::sanitize('qüx'),
+ "q\xfcx",
+ 'it_html::sanitize with latin1'
+);
+
+is(
+ it_html::sanitize('q←x'),
+ "q←x",
+ 'it_html::sanitize preserve non-decodable numeric entities'
+);
+is(it_html::entity_decode("’"), "'");
+is(it_html::entity_decode(""), " ");
is(it_html::entity_decode("ϧ"), " ");
?>
--
cgit v1.2.3
From b7200b739ff651a7647d2d666e3674a7fe3cb6e2 Mon Sep 17 00:00:00 2001
From: Urban Müller
Date: Mon, 26 Mar 2012 15:11:39 +0000
Subject: fixed it_html::fix_encoding
---
tests/it_html.t | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'tests/it_html.t')
diff --git a/tests/it_html.t b/tests/it_html.t
index c955359..a576b47 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -168,4 +168,16 @@ is(
is(it_html::entity_decode("’"), "'");
is(it_html::entity_decode(""), " ");
is(it_html::entity_decode("ϧ"), " ");
+
+is(it_html::fix_encoding("Meier"), "Meier");
+is(it_html::fix_encoding("Müller"), "Müller");
+is(it_html::fix_encoding("Aslı"), "Aslı");
+is(it_html::fix_encoding("é»"), "é»");
+
+is(it_html::fix_encoding(utf8_encode("Müller"), true), "Müller", "double encoded latin1"); # Double encoded latin1
+is(it_html::fix_encoding(utf8_encode("Aslı"), true), "Aslı"); # Double encoded non-latin1
+is(it_html::fix_encoding(utf8_encode("é»"), true), "é»"); # Double encoded special combination
+
+is(it_html::fix_encoding(utf8_decode("Müller"), true), "Müller"); # Incorrectly decoded latin1
+
?>
--
cgit v1.2.3
From bbcc6615dc5316a73f07b262950ac18d50c80497 Mon Sep 17 00:00:00 2001
From: Christian Schneider
Date: Mon, 26 Mar 2012 15:16:01 +0000
Subject: Improve it_html tests
---
tests/it_html.t | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
(limited to 'tests/it_html.t')
diff --git a/tests/it_html.t b/tests/it_html.t
index a576b47..b1d271e 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -165,19 +165,19 @@ is(
"q←x",
'it_html::sanitize preserve non-decodable numeric entities'
);
-is(it_html::entity_decode("’"), "'");
-is(it_html::entity_decode(""), " ");
-is(it_html::entity_decode("ϧ"), " ");
+is(it_html::entity_decode("’"), "'", "it_html::entity_decode numeric decimal entity");
+is(it_html::entity_decode(""), " ", "it_html::entity_decode invalid numeric hex entity");
+is(it_html::entity_decode("ϧ"), " ", "it_html::entity_decode invalid numeric decimal entity");
-is(it_html::fix_encoding("Meier"), "Meier");
-is(it_html::fix_encoding("Müller"), "Müller");
-is(it_html::fix_encoding("Aslı"), "Aslı");
-is(it_html::fix_encoding("é»"), "é»");
+is(it_html::fix_encoding("Meier"), "Meier", "it_html::fix_encoding ascii");
+is(it_html::fix_encoding("Müller"), "Müller", "it_html::fix_encoding utf-8 latin1");
+is(it_html::fix_encoding("Aslı"), "Aslı", "it_html::fix_encoding utf-8 non-latin1");
+is(it_html::fix_encoding("é»"), "é»", "it_html::fix_encoding utf-8 latin1 special combination");
-is(it_html::fix_encoding(utf8_encode("Müller"), true), "Müller", "double encoded latin1"); # Double encoded latin1
-is(it_html::fix_encoding(utf8_encode("Aslı"), true), "Aslı"); # Double encoded non-latin1
-is(it_html::fix_encoding(utf8_encode("é»"), true), "é»"); # Double encoded special combination
+is(it_html::fix_encoding(utf8_encode("Müller"), true), "Müller", "it_html::fix_encoding double encoded latin1");
+is(it_html::fix_encoding(utf8_encode("Aslı"), true), "Aslı", "it_html::fix_encoding double encoded non-latin1");
+is(it_html::fix_encoding(utf8_encode("é»"), true), "é»", "it_html::fix_encoding double encoded latin1 special combination");
-is(it_html::fix_encoding(utf8_decode("Müller"), true), "Müller"); # Incorrectly decoded latin1
+is(it_html::fix_encoding(utf8_decode("Müller"), true), "Müller", "it_html::fix_encoding incorrectly encoded latin1");
?>
--
cgit v1.2.3
From b1c0b4946572027c8de564730a89ec584c830bf3 Mon Sep 17 00:00:00 2001
From: Christian Schneider
Date: Wed, 28 Mar 2012 13:00:39 +0000
Subject: Added it::any2utf8, fixed it::replace fast path to add u modified,
added error reporting for invalid utf-8 input to it::match and it::replace
---
tests/it_html.t | 1 +
1 file changed, 1 insertion(+)
(limited to 'tests/it_html.t')
diff --git a/tests/it_html.t b/tests/it_html.t
index b1d271e..770d11a 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -153,6 +153,7 @@ is(it_html::entity_decode("A"), "A");
#
it_html::configure(array('charset' => "iso-8859-1"));
+ini_set('default_charset', "iso-8859-1");
is(
it_html::sanitize('qüx'),
--
cgit v1.2.3
From a60fb69ff8e7755ab969298ab85a2b63bbcc8b14 Mon Sep 17 00:00:00 2001
From: Christian Weber
Date: Fri, 30 Mar 2012 16:13:15 +0000
Subject: add GREEN HEART unit test for it_html::fix_encoding()
---
tests/it_html.t | 2 ++
1 file changed, 2 insertions(+)
(limited to 'tests/it_html.t')
diff --git a/tests/it_html.t b/tests/it_html.t
index 770d11a..2323e5e 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -181,4 +181,6 @@ is(it_html::fix_encoding(utf8_encode("é»"), true), "é»", "it_html::fix_encod
is(it_html::fix_encoding(utf8_decode("Müller"), true), "Müller", "it_html::fix_encoding incorrectly encoded latin1");
+is(it_html::fix_encoding("a💚b"), "a💚b", "it_html::fix_encoding incorrectly encoded GREEN HEART");
+
?>
--
cgit v1.2.3
From 3242f516a6c3e89fa898d96927746447e15d7750 Mon Sep 17 00:00:00 2001
From: Christian Weber
Date: Fri, 30 Mar 2012 16:17:08 +0000
Subject: correct GREEN HEART test description
---
tests/it_html.t | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'tests/it_html.t')
diff --git a/tests/it_html.t b/tests/it_html.t
index 2323e5e..174c487 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -181,6 +181,6 @@ is(it_html::fix_encoding(utf8_encode("é»"), true), "é»", "it_html::fix_encod
is(it_html::fix_encoding(utf8_decode("Müller"), true), "Müller", "it_html::fix_encoding incorrectly encoded latin1");
-is(it_html::fix_encoding("a💚b"), "a💚b", "it_html::fix_encoding incorrectly encoded GREEN HEART");
+is(it_html::fix_encoding("a💚b"), "a💚b", "it_html::fix_encoding correctly handles 4-byte utf-8 character GREEN HEART");
?>
--
cgit v1.2.3