writeFile creates a file of the given size relative to the test's working directory. Truncate makes a sparse file, so a size over the image limit costs nothing to create.
(t *testing.T, name string, size int64)
| 15 | // directory. Truncate makes a sparse file, so a size over the image limit costs |
| 16 | // nothing to create. |
| 17 | func writeFile(t *testing.T, name string, size int64) { |
| 18 | t.Helper() |
| 19 | |
| 20 | f, err := os.Create(name) |
| 21 | require.NoError(t, err) |
| 22 | defer f.Close() |
| 23 | require.NoError(t, f.Truncate(size)) |
| 24 | } |
| 25 | |
| 26 | func TestNewAsset(t *testing.T) { |
| 27 | tests := []struct { |
no test coverage detected