elvish/edit/wcwidth_test.go
2014-03-10 00:17:29 +08:00

26 lines
379 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)
}
}
}