* 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.
()
| 38 | * directory is itself named `testing`, its `private` is still not testing's. |
| 39 | */ |
| 40 | function 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 | |
| 51 | const FILES: Record<string, string> = { |
| 52 | 'go.mod': 'module example.com/app\n\ngo 1.22\n', |
no test coverage detected