github.com/markusbkk/elvish@v0.0.0-20231204143114-91dc52438621/pkg/cli/term/setup_unix_test.go (about)

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