(t *testing.T)
| 150 | } |
| 151 | |
| 152 | func newTestVirtualTerminal(t *testing.T) *expect.Console { |
| 153 | t.Helper() |
| 154 | |
| 155 | // Create a PTY and hook up a virtual terminal emulator |
| 156 | ptm, pts, err := pty.Open() |
| 157 | require.NoError(t, err) |
| 158 | |
| 159 | term := vt10x.New(vt10x.WithWriter(pts)) |
| 160 | |
| 161 | // Create a console via Expect that allows scripting against the terminal |
| 162 | consoleOpts := []expect.ConsoleOpt{ |
| 163 | expect.WithStdin(ptm), |
| 164 | expect.WithStdout(term), |
| 165 | expect.WithCloser(ptm, pts), |
| 166 | failOnExpectError(t), |
| 167 | failOnSendError(t), |
| 168 | expect.WithDefaultTimeout(time.Second), |
| 169 | } |
| 170 | |
| 171 | console, err := expect.NewConsole(consoleOpts...) |
| 172 | require.NoError(t, err) |
| 173 | t.Cleanup(func() { testCloser(t, console) }) |
| 174 | |
| 175 | return console |
| 176 | } |
| 177 | |
| 178 | func newTestIOStreams(t *testing.T, console *expect.Console, spinnerDisabled bool) *IOStreams { |
| 179 | t.Helper() |
no test coverage detected