edit: Add a very basic test against setupTerminal.

This commit is contained in:
Qi Xiao 2017-05-21 22:09:10 +01:00
parent c1fa531ac8
commit c48dc45bdc

24
edit/editor_test.go Normal file
View File

@ -0,0 +1,24 @@
package edit
import (
"testing"
"github.com/kr/pty"
)
func TestSetupTerminal(t *testing.T) {
pty, tty, err := pty.Open()
if err != nil {
t.Errorf("cannot open pty for testing setupTerminal")
}
defer pty.Close()
defer tty.Close()
_, err = setupTerminal(tty)
if err != nil {
t.Errorf("setupTerminal returns an error")
}
// TODO(xiaq): Test whether the interesting flags in the termios were indeed
// set.
// termios, err := sys.NewTermiosFromFd(int(tty.Fd()))
}