go-prompt/prompt/render_test.go

30 lines
420 B
Go
Raw Normal View History

2017-07-15 09:51:33 +00:00
package prompt
import (
"reflect"
2017-07-15 13:23:47 +00:00
"testing"
2017-07-15 09:51:33 +00:00
)
func TestFormatCompletion(t *testing.T) {
2017-07-15 13:23:47 +00:00
in := []string{
2017-07-15 09:51:33 +00:00
"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)
}
}