MCPcopy
hub / github.com/cli/cli / newTerminal

Function newTerminal

pkg/surveyext/editor_test.go:197–218  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

195}
196
197func newTerminal(t *testing.T) *testTerminal {
198 t.Helper()
199
200 pty, tty, err := pseudotty.Open()
201 if errors.Is(err, pseudotty.ErrUnsupported) {
202 t.SkipNow()
203 return nil
204 }
205 if err != nil {
206 t.Fatal(err)
207 }
208 t.Cleanup(func() {
209 pty.Close()
210 tty.Close()
211 })
212
213 if err := pseudotty.Setsize(tty, &pseudotty.Winsize{Cols: 72, Rows: 30}); err != nil {
214 t.Fatal(err)
215 }
216
217 return &testTerminal{pty: pty, tty: tty}
218}
219
220func (t *testTerminal) SendKey(c rune) error {
221 _, err := t.pty.WriteString(string(c))

Calls 3

OpenMethod · 0.80
HelperMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected