| 1 | //go:build darwin || linux |
| 2 | |
| 3 | package osfs |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/go-git/go-billy/v6" |
| 9 | "github.com/stretchr/testify/require" |
| 10 | ) |
| 11 | |
| 12 | func assertMmapBackingWhenAvailable(t *testing.T, f billy.File) { |
| 13 | t.Helper() |
| 14 | _, ok := f.(*mmapFile) |
| 15 | require.True(t, ok, "WithMmap should select *mmapFile on this platform, got %T", f) |
| 16 | } |
| 17 | |
| 18 | // Ensure *mmapFile satisfies billy.File at compile-time on platforms |
| 19 | // where it has a real implementation. |
| 20 | var _ billy.File = (*mmapFile)(nil) |