mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
26 lines
374 B
Go
26 lines
374 B
Go
|
package edit
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
var wcwidthTests = []struct{
|
||
|
in rune
|
||
|
wanted int
|
||
|
}{
|
||
|
{'\u0301', 0}, // Combining acute accent
|
||
|
{'a', 1},
|
||
|
{'Ω', 1},
|
||
|
{'好', 2},
|
||
|
{'か', 2},
|
||
|
}
|
||
|
|
||
|
func TestWcwidth(t *testing.T) {
|
||
|
for _, tt := range wcwidthTests {
|
||
|
out := wcwidth(tt.in)
|
||
|
if out != tt.wanted {
|
||
|
t.Errorf("wcwidth(%q) => %v, want %v", tt.in, out, tt.wanted)
|
||
|
}
|
||
|
}
|
||
|
}
|