go-prompt/prompt/render_test.go
2017-07-15 22:23:47 +09:00

30 lines
420 B
Go

package prompt
import (
"reflect"
"testing"
)
func TestFormatCompletion(t *testing.T) {
in := []string{
"select",
"from",
"insert",
"where",
}
ex := []string{
"select",
"from ",
"insert",
"where ",
}
ac, width := formatCompletions(in)
if !reflect.DeepEqual(ac, ex) {
t.Errorf("Should be %#v, but got %#v", ex, ac)
}
if width != 6 {
t.Errorf("Should be %#v, but got %#v", 4, width)
}
}