mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
pkg/expect: replace SendLine with Send method
This commit is contained in:
@@ -114,7 +114,7 @@ func (ep *ExpectProcess) Close() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (ep *ExpectProcess) SendLine(command string) error {
|
||||
_, err := io.WriteString(ep.fpty, command+"\r\n")
|
||||
func (ep *ExpectProcess) Send(command string) error {
|
||||
_, err := io.WriteString(ep.fpty, command)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ func TestEcho(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendLine(t *testing.T) {
|
||||
func TestSend(t *testing.T) {
|
||||
ep, err := NewExpect("/usr/bin/tr", "a", "b")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer ep.Close()
|
||||
if err := ep.SendLine("a"); err != nil {
|
||||
if err := ep.Send("a\r"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, eerr := ep.Expect("b")
|
||||
|
||||
Reference in New Issue
Block a user