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)
| 55 | // operating systems. Windows in particular has a lot of restrictions the |
| 56 | // characters that can be used in file paths. |
| 57 | func 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 |
no test coverage detected
searching dependent graphs…