bad_punycode_tests.json |
|
8334 |
deprecated.rs |
|
6864 |
IdnaTestV2.txt |
|
749716 |
punycode.rs |
|
4201 |
punycode_tests.json |
|
4352 |
tests.rs |
|
773 |
unit.rs |
|
4499 |
unitbis.rs |
// http://www.unicode.org/reports/tr46/#Table_Example_Processing
#[test]
fn test_examples() {
let codec = idna::uts46bis::Uts46::new();
let mut out = String::new();
assert_matches!(codec.to_unicode("Bloß.de", &mut out), Ok(()));
assert_eq!(out, "bloß.de");
out.clear();
assert_matches!(codec.to_unicode("xn--blo-7ka.de", &mut out), Ok(()));
assert_eq!(out, "bloß.de");
out.clear();
assert_matches!(codec.to_unicode("u\u{308}.com", &mut out), Ok(()));
assert_eq!(out, "ü.com");
out.clear();
assert_matches!(codec.to_unicode("xn--tda.com", &mut out), Ok(()));
assert_eq!(out, "ü.com");
out.clear();
assert_matches!(codec.to_unicode("xn--u-ccb.com", &mut out), Err(_));
out.clear();
assert_matches!(codec.to_unicode("a⒈com", &mut out), Err(_));
out.clear();
assert_matches!(codec.to_unicode("xn--a-ecp.ru", &mut out), Err(_));
out.clear();
assert_matches!(codec.to_unicode("xn--0.pt", &mut out), Err(_));
out.clear();
assert_matches!(codec.to_unicode("日本語。JP", &mut out), Ok(()));
assert_eq!(out, "日本語.jp");
out.clear();
assert_matches!(codec.to_unicode("☕.us", &mut out), Ok(()));
assert_eq!(out, "☕.us");
}
|
8905 |
uts46.rs |
|
8980 |