encoding.utf8.east_asian: add support for East_Asian_Width (#8978)

See https://www.unicode.org/reports/tr11/
pull/8989/head
zakuro 2021-02-26 16:52:07 +09:00 committed by GitHub
parent 524372d49c
commit 995bd66970
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1227 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
module east_asian
fn test_width() {
assert east_asian_width_property_at('A', 0) == .narrow
assert east_asian_width_property_at('', 0) == .full
assert east_asian_width_property_at('', 0) == .half
assert east_asian_width_property_at('', 0) == .wide
assert east_asian_width_property_at('', 0) == .ambiguous
assert east_asian_width_property_at('ج', 0) == .neutral
assert display_width('abc', 1) == 3
assert display_width('', 1) == 8
assert display_width('', 1) == 8
assert display_width('', 1) == 4
assert display_width('', 1) == 4
assert display_width('', 1) == 4
assert display_width('', 1) == 4
assert display_width('', 1) == 6
assert display_width('', 1) == 6
assert display_width(' िि', 1) == 9
assert display_width('', 1) == 1
assert display_width('', 2) == 2
assert display_width('🐈👽📛', 1) == 6
}