MCPcopy Index your code
hub / github.com/github/copilot-sdk / newInMemoryClient

Function newInMemoryClient

go/client_test.go:1554–1580  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1552}
1553
1554func newInMemoryClient(t *testing.T) (*Client, *requestRecorder, func()) {
1555 t.Helper()
1556
1557 stdinR, stdinW := io.Pipe()
1558 stdoutR, stdoutW := io.Pipe()
1559 rpcClient := jsonrpc2.NewClient(stdinW, stdoutR)
1560 rpcClient.Start()
1561
1562 client := NewClient(&ClientOptions{})
1563 client.client = rpcClient
1564 client.RPC = rpc.NewServerRPC(rpcClient)
1565 client.state = stateConnected
1566
1567 requests := &requestRecorder{}
1568 done := make(chan struct{})
1569 go serveInMemoryRuntime(t, stdinR, stdoutW, requests, done)
1570
1571 cleanup := func() {
1572 rpcClient.Stop()
1573 stdinR.Close()
1574 stdinW.Close()
1575 stdoutR.Close()
1576 stdoutW.Close()
1577 <-done
1578 }
1579 return client, requests, cleanup
1580}
1581
1582func serveInMemoryRuntime(t *testing.T, stdinR *io.PipeReader, stdoutW *io.PipeWriter, requests *requestRecorder, done chan<- struct{}) {
1583 t.Helper()

Calls 6

StartMethod · 0.95
StopMethod · 0.95
serveInMemoryRuntimeFunction · 0.85
NewClientMethod · 0.80
NewClientFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…