MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / fakeTestingTB

Function fakeTestingTB

__tests__/go-implements-stdlib.test.ts:40–49  ·  view source on GitHub ↗

* A project struct declaring every method `testing.TB` has, at its counts, * its unexported `private` included, and a TBRun's `Run`: in a package whose * directory is itself named `testing`, its `private` is still not testing's.

()

Source from the content-addressed store, hash-verified

38 * directory is itself named `testing`, its `private` is still not testing's.
39 */
40function fakeTestingTB(): string {
41 const lines = ['package testing', '', 'type fakeTB struct{}', ''];
42 for (const [name, arity] of [...goStdlibMethods('testing', 'TB')!, ['Run', '2/1'] as const]) {
43 const [params, results] = arity.split('/').map(Number) as [number, number];
44 const list = Array.from({ length: params }, (_, i) => `a${i} int`).join(', ');
45 const result = results === 0 ? '' : results === 1 ? ' int' : ` (${Array(results).fill('int').join(', ')})`;
46 lines.push(`func (f *fakeTB) ${name}(${list})${result} { panic(0) }`);
47 }
48 return `${lines.join('\n')}\n`;
49}
50
51const FILES: Record<string, string> = {
52 'go.mod': 'module example.com/app\n\ngo 1.22\n',

Callers 1

Calls 6

goStdlibMethodsFunction · 0.90
mapMethod · 0.80
fromMethod · 0.80
fillMethod · 0.80
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected