WriteFile writes a file to the filesystem.
(t *testing.T, fs billy.Filesystem, path, content string)
| 272 | |
| 273 | // WriteFile writes a file to the filesystem. |
| 274 | func WriteFile(t *testing.T, fs billy.Filesystem, path, content string) { |
| 275 | t.Helper() |
| 276 | file, err := fs.OpenFile(path, os.O_CREATE|os.O_RDWR, 0o644) |
| 277 | require.NoError(t, err) |
| 278 | _, err = file.Write([]byte(content)) |
| 279 | require.NoError(t, err) |
| 280 | err = file.Close() |
| 281 | require.NoError(t, err) |
| 282 | } |