1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-27 05:17:59 +01:00

Add tests for international user-ids

This commit is contained in:
Paul Schaub 2022-12-22 14:43:09 +01:00
parent 75f69c0473
commit a376587680
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -381,4 +381,64 @@ public class UserIdTest {
assertEquals("<alice@pgpainless.org>", id.toString());
}
@Test
public void parseLatinWithDiacritics() {
UserId pele = UserId.parse("Pelé@example.com");
assertEquals("Pelé@example.com", pele.getEmail());
pele = UserId.parse("Marquez Pelé <Pelé@example.com>");
assertEquals("Pelé@example.com", pele.getEmail());
assertEquals("Marquez Pelé", pele.getName());
}
@Test
public void parseGreekAlphabet() {
UserId dokimi = UserId.parse("δοκιμή@παράδειγμα.δοκιμή");
assertEquals("δοκιμή@παράδειγμα.δοκιμή", dokimi.getEmail());
dokimi = UserId.parse("δοκιμή <δοκιμή@παράδειγμα.δοκιμή>");
assertEquals("δοκιμή", dokimi.getName());
assertEquals("δοκιμή@παράδειγμα.δοκιμή", dokimi.getEmail());
}
@Test
public void parseTraditionalChinese() {
UserId womai = UserId.parse("我買@屋企.香港");
assertEquals("我買@屋企.香港", womai.getEmail());
womai = UserId.parse("我買 <我買@屋企.香港>");
assertEquals("我買@屋企.香港", womai.getEmail());
assertEquals("我買", womai.getName());
}
@Test
public void parseJapanese() {
UserId ninomiya = UserId.parse("二ノ宮@黒川.日本");
assertEquals("二ノ宮@黒川.日本", ninomiya.getEmail());
ninomiya = UserId.parse("二ノ宮 <二ノ宮@黒川.日本>");
assertEquals("二ノ宮@黒川.日本", ninomiya.getEmail());
assertEquals("二ノ宮", ninomiya.getName());
}
@Test
public void parseCyrillic() {
UserId medved = UserId.parse("медведь@с-балалайкой.рф");
assertEquals("медведь@с-балалайкой.рф", medved.getEmail());
medved = UserId.parse("медведь <медведь@с-балалайкой.рф>");
assertEquals("медведь@с-балалайкой.рф", medved.getEmail());
assertEquals("медведь", medved.getName());
}
@Test
public void parseDevanagari() {
UserId samparka = UserId.parse("संपर्क@डाटामेल.भारत");
assertEquals("संपर्क@डाटामेल.भारत", samparka.getEmail());
samparka = UserId.parse("संपर्क <संपर्क@डाटामेल.भारत>");
assertEquals("संपर्क@डाटामेल.भारत", samparka.getEmail());
assertEquals("संपर्क", samparka.getName());
}
}