Skip to content

Commit

Permalink
fix(wcwidth): add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Oct 22, 2024
1 parent f9d4e91 commit 261659d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions wcwidth/wcwidth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,29 @@ var runewidthtests = []struct {
{'Ω', 1},
{'好', 2},
{'か', 2},
{'コ', 2},
{'ン', 2},
{'ニ', 2},
{'チ', 2},
{'ハ', 2},
{',', 1},
{' ', 1},
{'セ', 2},
{'カ', 2},
{'イ', 2},
{'!', 1},
{'a', 1},
{'A', 1},
{'z', 1},
{'Z', 1},
{'#', 1},
{'\u05bf', 0}, // Combining
{'\u0301', 0}, // Combining acute accent
{'\u0410', 1}, // Cyrillic Capital Letter A
{'\u0488', 0}, // Combining Cyrillic Hundred Thousands Sign
{'\u00ad', 0}, // Soft hyphen
{0, 0}, // Special case, width of null rune is zero
{'\u00a0', 0},
}

func BenchmarkRuneWidth(b *testing.B) {
Expand Down Expand Up @@ -100,6 +123,9 @@ func TestZeroWidthJoiner(t *testing.T) {
{"あ\u200dい", 4},
{"abc", 3},
{"你好", 4},
{"Hello!", 6},
{"Hello, 世界!", 12},
{"ᬓᬨᬮ᭄", 4},
}

for _, tt := range tests {
Expand Down

0 comments on commit 261659d

Please sign in to comment.