TestOpenFile creates a new file called name and returns the opened file.
(tb testing.TB, name string)
| 26 | |
| 27 | // TestOpenFile creates a new file called name and returns the opened file. |
| 28 | func TestOpenFile(tb testing.TB, name string) *os.File { |
| 29 | tb.Helper() |
| 30 | f, err := os.OpenFile(filepath.Clean(name), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600) |
| 31 | if err != nil { |
| 32 | tb.Fatal(err) |
| 33 | } |
| 34 | return f |
| 35 | } |
| 36 | |
| 37 | // OpenLogFile creates a new file that emulates being a log. |
| 38 | func OpenLogFile(tb testing.TB, name string) *os.File { |
no outgoing calls
no test coverage detected