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

Function writeEvents

scripts/gotestsummary/main_test.go:209–222  ·  view source on GitHub ↗
(t *testing.T, events ...testEvent)

Source from the content-addressed store, hash-verified

207}
208
209func writeEvents(t *testing.T, events ...testEvent) string {
210 t.Helper()
211 dir := t.TempDir()
212 path := filepath.Join(dir, "go-test.json")
213 var content strings.Builder
214 for _, event := range events {
215 line, err := json.Marshal(event)
216 require.NoError(t, err)
217 _, _ = content.Write(line)
218 _ = content.WriteByte('\n')
219 }
220 require.NoError(t, os.WriteFile(path, []byte(content.String()), 0o600))
221 return path
222}
223
224func assertFileContent(t *testing.T, path string, expected string) {
225 t.Helper()

Calls 6

HelperMethod · 0.65
TempDirMethod · 0.65
WriteMethod · 0.65
WriteFileMethod · 0.65
MarshalMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected