Skip to content

Commit 0eb0ef4

Browse files
committed
added tests for modifiers
1 parent 2ba775c commit 0eb0ef4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/test.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
$test_kddi = "Hello ".utf8_bytes(0xE490);
2626
$test_google = "Hello ".utf8_bytes(0xFE02C);
2727

28-
$test_html = "Hello <span class=\"emoji-outer emoji-sizer\"><span class=\"emoji-inner emoji2649\"></span></span>";
28+
$test_html = "Hello ".test_html(2649);
2929

3030
is(emoji_docomo_to_unified($test_docomo), $test_unified, "DoCoMo -> Unified");
3131
is(emoji_kddi_to_unified($test_kddi), $test_unified, "KDDI -> Unified");
@@ -105,6 +105,17 @@
105105
is(emoji_contains_emoji('hello world'), false, "does not contain emoji");
106106

107107

108+
echo "#------------------\n";
109+
110+
111+
#
112+
# deal with modifiers correctly
113+
#
114+
115+
is(emoji_unified_to_html("\xE2\x9D\xA4"), test_html('2764'), "no modifier");
116+
is(emoji_unified_to_html("\xE2\x9D\xA4\xEF\xB8\x8F"), test_html('2764'), "image modifier");
117+
is(emoji_unified_to_html("\xE2\x9D\xA4\xEF\xB8\x8E"), "\xE2\x9D\xA4\xEF\xB8\x8E", "text modifier");
118+
108119

109120

110121
#
@@ -168,3 +179,7 @@ function utf8_bytes($cp){
168179
return chr($cp);
169180
}
170181
}
182+
183+
function test_html($codepoint){
184+
return "<span class=\"emoji-outer emoji-sizer\"><span class=\"emoji-inner emoji{$codepoint}\"></span></span>";
185+
}

0 commit comments

Comments
 (0)