MCPcopy
hub / github.com/go-task/task / goldenFileName

Function goldenFileName

task_test.go:57–64  ·  view source on GitHub ↗

goldenFileName makes the file path for fixture files safe for all well-known operating systems. Windows in particular has a lot of restrictions the characters that can be used in file paths.

(t *testing.T)

Source from the content-addressed store, hash-verified

55// operating systems. Windows in particular has a lot of restrictions the
56// characters that can be used in file paths.
57func goldenFileName(t *testing.T) string {
58 t.Helper()
59 name := t.Name()
60 for _, c := range []string{` `, `<`, `>`, `:`, `"`, `/`, `\`, `|`, `?`, `*`} {
61 name = strings.ReplaceAll(name, c, "-")
62 }
63 return name
64}
65
66// writeFixture writes a fixture file for the test. The fixture file is created
67// using the [goldie.Goldie] package. The fixture file is created with the

Callers 1

writeFixtureMethod · 0.85

Calls 1

NameMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…