github.com/oweisse/u-root@v0.0.0-20181109060735-d005ad25fef1/cmds/elvish/edit/tty/setup_unix_test.go (about)

     1  // +build !windows,plan9
     2  
     3  package tty
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/kr/pty"
     9  )
    10  
    11  func TestSetupTerminal(t *testing.T) {
    12  	pty, tty, err := pty.Open()
    13  	if err != nil {
    14  		t.Errorf("cannot open pty for testing setupTerminal")
    15  	}
    16  	defer pty.Close()
    17  	defer tty.Close()
    18  
    19  	_, err = setup(tty)
    20  	if err != nil {
    21  		t.Errorf("setupTerminal returns an error")
    22  	}
    23  	// TODO(xiaq): Test whether the interesting flags in the termios were indeed
    24  	// set.
    25  	// termios, err := sys.NewTermiosFromFd(int(tty.Fd()))
    26  }