func NewLogView(parent View, height int) (*LogView, error) { lv := &LogView{ ViewBase: ViewBase{parent}, rlconfig: readline.NewConfig(), height: height, } cwd := "" bash, err := bash.StartBash() if err != nil { return nil, err } lv.shell = shell.NewShell(cwd, nil, bash) lv.shell.LoadEnv() lv.addEntry() return lv, nil }
func TestComplete(t *testing.T) { ui := fake.NewUI() parent := NewTestViewHost(ui) delegate := &testPromptDelegate{} config := &readline.Config{} shell := shell.NewShell(".", map[string]string{}, delegate) pv := NewPromptView(parent, delegate, config, shell) pv.StartComplete() ui.RunQueue(true) assert.Equal(t, pv.readline.Text, []byte("")) pv.readline.Text = []byte("ls l") pv.readline.Pos = 4 pv.StartComplete() ui.RunQueue(true) assert.Equal(t, pv.readline.Text, []byte("ls log")) }