MCPcopy Index your code
hub / github.com/coder/coder / New

Function New

pty/ptytest/ptytest.go:28–44  ·  view source on GitHub ↗
(t *testing.T, opts ...pty.Option)

Source from the content-addressed store, hash-verified

26)
27
28func New(t *testing.T, opts ...pty.Option) *PTY {
29 t.Helper()
30
31 ptty, err := newTestPTY(opts...)
32 require.NoError(t, err)
33
34 e := newExpecter(t, ptty.Output(), "cmd")
35 r := &PTY{
36 outExpecter: e,
37 PTY: ptty,
38 }
39 // Ensure pty is cleaned up at the end of test.
40 t.Cleanup(func() {
41 _ = r.Close()
42 })
43 return r
44}
45
46// Start starts a new process asynchronously and returns a PTYCmd and Process.
47// It kills the process and PTYCmd upon cleanup

Callers 15

TestCliTemplateCreateFunction · 0.92
TestUserDeleteFunction · 0.92
TestTemplateDeleteFunction · 0.92
TestGitAskpassFunction · 0.92
TestExpTaskListFunction · 0.92
TestExternalAuthFunction · 0.92
TestTemplatePull_ToDirFunction · 0.92
TestRenameFunction · 0.92
TestExpTaskResumeFunction · 0.92

Calls 6

CloseMethod · 0.95
newExpecterFunction · 0.85
newTestPTYFunction · 0.70
HelperMethod · 0.65
OutputMethod · 0.65
CleanupMethod · 0.65

Tested by 15

TestCliTemplateCreateFunction · 0.74
TestUserDeleteFunction · 0.74
TestTemplateDeleteFunction · 0.74
TestGitAskpassFunction · 0.74
TestExpTaskListFunction · 0.74
TestExternalAuthFunction · 0.74
TestTemplatePull_ToDirFunction · 0.74
TestRenameFunction · 0.74
TestExpTaskResumeFunction · 0.74