10000 Add some extra tests · cbarrick/unicode-segmentation@8e06fc9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e06fc9

Browse files
Manishearthmbrubeck
authored andcommitted
Add some extra tests
1 parent 6ff3993 commit 8e06fc9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,14 @@ fn test_graphemes() {
9191
fn test_words() {
9292
use testdata::TEST_WORD;
9393

94-
for &(s, w) in TEST_WORD {
94+
// Unicode's official tests don't really test longer chains of flag emoji
95+
// TODO This could be improved with more tests like flag emoji with interspersed Extend chars and ZWJ
96+
const EXTRA_TESTS: &'static [(&'static str, &'static [&'static str])] = &[
97+
("🇦🇫🇦🇽🇦🇱🇩🇿🇦🇸🇦🇩🇦🇴", &["🇦🇫", "🇦🇽", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇩", "🇦🇴"]),
98+
("🇦🇫🇦🇽🇦🇱🇩🇿🇦🇸🇦🇩🇦", &["🇦🇫", "🇦🇽", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇩", "🇦"]),
99+
("🇦a🇫🇦🇽a🇦🇱🇩🇿🇦🇸🇦🇩🇦", &["🇦", "a", "🇫🇦", "🇽", "a", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇩", "🇦"]),
100+
];
101+
for &(s, w) in TEST_WORD.iter().chain(EXTRA_TESTS.iter()) {
95102
macro_rules! assert_ {
96103
($test:expr, $exp:expr, $name:expr) => {
97104
// collect into vector for better diagnostics in failure case

0 commit comments

Comments
 (0)
0