aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2019-02-03 13:07:01 +0000
committerSimon McVittie <smcv@debian.org>2019-02-03 13:07:01 +0000
commit67c7542672e92642339a114692882cec494e9886 (patch)
tree7e208b7f7082b15ef2326d9648ed54ec693160d5
parent15ddbb1c70fecb052ef45ae96574a4d888578d11 (diff)
downloadikiwiki-67c7542672e92642339a114692882cec494e9886.tar
ikiwiki-67c7542672e92642339a114692882cec494e9886.tar.gz
t: Exercise Chinese and Cyrillic page titles
Signed-off-by: Simon McVittie <smcv@debian.org>
-rwxr-xr-xt/linkpage.t3
-rwxr-xr-xt/pagetitle.t6
-rwxr-xr-xt/titlepage.t3
3 files changed, 12 insertions, 0 deletions
diff --git a/t/linkpage.t b/t/linkpage.t
index f1ee235ef..20525fd5b 100755
--- a/t/linkpage.t
+++ b/t/linkpage.t
@@ -2,6 +2,7 @@
use warnings;
use strict;
use Test::More;
+use utf8;
BEGIN { use_ok("IkiWiki"); }
@@ -16,6 +17,8 @@ is(linkpage("foo bar__95__baz"), "foo_bar__95__baz", 'underscore');
is(linkpage("foo bar\xACbaz"), "foo_bar__172__baz", 'U+00AC is in Latin-1 range');
is(linkpage("foo bar\x{04D2}baz"), "foo_bar\x{04D2}baz", 'U+04D2 is alphanumeric');
is(linkpage("foo bar\x{2260}baz"), "foo_bar__8800__baz", 'U+2260 is nonalphanumeric');
+is(linkpage("中文"), "中文", 'Chinese');
+is(linkpage("Кириллица"), "Кириллица", 'Cyrillic');
is(linkpage("foo bar\x{0001F4A9}baz"), "foo_bar__128169__baz", 'U+1F4A9 is outside BMP');
done_testing;
diff --git a/t/pagetitle.t b/t/pagetitle.t
index d00d9d297..c6d626ada 100755
--- a/t/pagetitle.t
+++ b/t/pagetitle.t
@@ -15,6 +15,8 @@ is(pagetitle("foo_bar__1234__baz"), "foo bar&#1234;baz", 'Unicode in BMP');
is(pagetitle("foo_bar__8800__baz"), "foo bar&#8800;baz", 'Unicode in BMP');
is(pagetitle("foo_bar___33___baz"), "foo bar &#33; baz", 'Exclamation mark');
is(pagetitle("foo_bar___95___baz"), "foo bar &#95; baz", 'Underscore');
+is(pagetitle("中文"), "中文", 'Chinese');
+is(pagetitle("Кириллица"), "Кириллица", 'Cyrillic');
# Outside basic multilingual plane: &#128169 is U+1F4A9 PILE OF POO
is(pagetitle("foo_bar__128169__baz"), "foo bar&#128169;baz", 'Unicode outside BMP');
@@ -24,6 +26,8 @@ is(pagetitle("foo_bar__1234__baz", undef), "foo bar&#1234;baz", 'Unicode in BMP'
is(pagetitle("foo_bar__8800__baz", undef), "foo bar&#8800;baz", 'Unicode in BMP');
is(pagetitle("foo_bar___33___baz", ""), "foo bar &#33; baz", 'Exclamation mark');
is(pagetitle("foo_bar___95___baz", 0), "foo bar &#95; baz", 'Underscore');
+is(pagetitle("中文", 0), "中文", 'Chinese');
+is(pagetitle("Кириллица", 0), "Кириллица", 'Cyrillic');
is(pagetitle("foo_bar__128169__baz", 0), "foo bar&#128169;baz", 'Unicode outside BMP');
# pagetitle(x, true) => unescaped form of page title
@@ -36,6 +40,8 @@ is(chr(8800), "\x{2260}");
is(pagetitle("foo_bar__8800__baz", 1), "foo bar\x{2260}baz", 'Unicode in BMP');
is(pagetitle("foo_bar___33___baz", 1), "foo bar ! baz");
is(pagetitle("foo_bar___95___baz", 1), "foo bar _ baz");
+is(pagetitle("中文", 1), "中文", 'Chinese');
+is(pagetitle("Кириллица", 1), "Кириллица", 'Cyrillic');
is(chr(128169), "\x{0001F4A9}");
is(pagetitle("foo_bar__128169__baz", 1), "foo bar\x{0001F4A9}baz", 'Unicode outside BMP');
diff --git a/t/titlepage.t b/t/titlepage.t
index d6bb1b121..a09432fd7 100755
--- a/t/titlepage.t
+++ b/t/titlepage.t
@@ -2,6 +2,7 @@
use warnings;
use strict;
use Test::More;
+use utf8;
BEGIN { use_ok("IkiWiki"); }
@@ -14,6 +15,8 @@ is(titlepage("foo bar_baz"), "foo_bar__95__baz");
is(titlepage("foo bar\xACbaz"), "foo_bar__172__baz", 'U+00AC is in Latin-1 range');
is(titlepage("foo bar\x{04D2}baz"), "foo_bar\x{04D2}baz", 'U+04D2 is alphanumeric');
is(titlepage("foo bar\x{2260}baz"), "foo_bar__8800__baz", 'U+2260 is nonalphanumeric');
+is(titlepage("中文"), "中文", 'Chinese');
+is(titlepage("Кириллица"), "Кириллица", 'Cyrillic');
is(titlepage("foo bar\x{0001F4A9}baz"), "foo_bar__128169__baz", 'U+1F4A9 is outside BMP');
done_testing;