setup_unix_test.go 507 B

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