github.com/bhameyie/otto@v0.2.1-0.20160406174117-16052efa52ec/command/ui_test.go (about) 1 package command 2 3 import ( 4 "bytes" 5 "testing" 6 7 "github.com/hashicorp/otto/ui" 8 ) 9 10 func TestCliUi_impl(t *testing.T) { 11 var _ ui.Ui = new(cliUi) 12 } 13 14 func TestCliUiInput(t *testing.T) { 15 i := &cliUi{ 16 Reader: bytes.NewBufferString("foo\n"), 17 Writer: bytes.NewBuffer(nil), 18 } 19 20 v, err := i.Input(&ui.InputOpts{}) 21 if err != nil { 22 t.Fatalf("err: %s", err) 23 } 24 25 if v != "foo" { 26 t.Fatalf("bad: %#v", v) 27 } 28 }