6 BEGIN { use_ok("IkiWiki"); }
8 # pagetitle(x) => XML-escaped form of page title
9 is(pagetitle("foo_bar"), "foo bar");
10 is(pagetitle("foo_bar_baz"), "foo bar baz");
11 is(pagetitle("foo_bar__33__baz"), "foo bar!baz");
12 # Ӓ is U+04D2 CYRILLIC CAPITAL LETTER A WITH DIAERESIS
13 is(pagetitle("foo_bar__1234__baz"), "foo barӒbaz", 'Unicode in BMP');
14 # ≠ is U+2260 NOT EQUAL TO
15 is(pagetitle("foo_bar__8800__baz"), "foo bar≠baz", 'Unicode in BMP');
16 is(pagetitle("foo_bar___33___baz"), "foo bar ! baz", 'Exclamation mark');
17 is(pagetitle("foo_bar___95___baz"), "foo bar _ baz", 'Underscore');
18 # Outside basic multilingual plane: 💩 is U+1F4A9 PILE OF POO
19 is(pagetitle("foo_bar__128169__baz"), "foo bar💩baz", 'Unicode outside BMP');
21 # pagetitle(x, false) => same
22 is(pagetitle("foo_bar__33__baz", 0), "foo bar!baz");
23 is(pagetitle("foo_bar__1234__baz", undef), "foo barӒbaz", 'Unicode in BMP');
24 is(pagetitle("foo_bar__8800__baz", undef), "foo bar≠baz", 'Unicode in BMP');
25 is(pagetitle("foo_bar___33___baz", ""), "foo bar ! baz", 'Exclamation mark');
26 is(pagetitle("foo_bar___95___baz", 0), "foo bar _ baz", 'Underscore');
27 is(pagetitle("foo_bar__128169__baz", 0), "foo bar💩baz", 'Unicode outside BMP');
29 # pagetitle(x, true) => unescaped form of page title
30 is(pagetitle("foo_bar", 1), "foo bar");
31 is(pagetitle("foo_bar_baz", 'unescaped'), "foo bar baz");
32 is(pagetitle("foo_bar__33__baz", 42), "foo bar!baz");
33 is(chr(1234), "\x{04D2}");
34 is(pagetitle("foo_bar__1234__baz", 1), "foo bar\x{04D2}baz", 'Unicode in BMP');
35 is(chr(8800), "\x{2260}");
36 is(pagetitle("foo_bar__8800__baz", 1), "foo bar\x{2260}baz", 'Unicode in BMP');
37 is(pagetitle("foo_bar___33___baz", 1), "foo bar ! baz");
38 is(pagetitle("foo_bar___95___baz", 1), "foo bar _ baz");
39 is(chr(128169), "\x{0001F4A9}");
40 is(pagetitle("foo_bar__128169__baz", 1), "foo bar\x{0001F4A9}baz", 'Unicode outside BMP');