浏览代码

pkg/expect: replace SendLine with Send method

Gyu-Ho Lee 9 年之前
父节点
当前提交
f4eaa3f8fb
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      pkg/expect/expect.go
  2. 2 2
      pkg/expect/expect_test.go

+ 2 - 2
pkg/expect/expect.go

@@ -114,7 +114,7 @@ func (ep *ExpectProcess) Close() error {
 	return err
 	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
 	return err
 }
 }

+ 2 - 2
pkg/expect/expect_test.go

@@ -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")
 	ep, err := NewExpect("/usr/bin/tr", "a", "b")
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
 	defer ep.Close()
 	defer ep.Close()
-	if err := ep.SendLine("a"); err != nil {
+	if err := ep.Send("a\r"); err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
 	_, eerr := ep.Expect("b")
 	_, eerr := ep.Expect("b")