MCPcopy Create free account
hub / github.com/coder/guts / importBlock

Function importBlock

imports_test.go:38–47  ·  view source on GitHub ↗

importBlock returns just the prefix before the first declaration, which is where Serialize emits the merged imports.

(t *testing.T, output string)

Source from the content-addressed store, hash-verified

36// importBlock returns just the prefix before the first declaration, which is
37// where Serialize emits the merged imports.
38func importBlock(t *testing.T, output string) string {
39 t.Helper()
40 require.True(t, strings.HasPrefix(output, "// Code generated by 'guts'. DO NOT EDIT."),
41 "output must start with the generated header, got %q", output)
42 end := strings.Index(output, "interface ")
43 if end < 0 {
44 end = len(output)
45 }
46 return output[:end]
47}
48
49// TestInjectImport_Merge proves that repeated InjectImport calls for the same
50// module collapse into a single statement and that specifiers are sorted by

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…