writeConfigFile writes content to a temp file and returns its path.
(t *testing.T, content string)
| 30 | |
| 31 | // writeConfigFile writes content to a temp file and returns its path. |
| 32 | func writeConfigFile(t *testing.T, content string) string { |
| 33 | t.Helper() |
| 34 | f, err := os.CreateTemp("", "nextdns-config-test-*.conf") |
| 35 | if err != nil { |
| 36 | t.Fatal(err) |
| 37 | } |
| 38 | if _, err := f.WriteString(content); err != nil { |
| 39 | t.Fatal(err) |
| 40 | } |
| 41 | f.Close() |
| 42 | t.Cleanup(func() { os.Remove(f.Name()) }) |
| 43 | return f.Name() |
| 44 | } |
| 45 | |
| 46 | // readFile reads the content of a file as a string. |
| 47 | func readFile(t *testing.T, path string) string { |
no test coverage detected
searching dependent graphs…