Files
core/io/fs/mem_test.go
Ingo Oppermann ecfbbe3857 Allow to list files by ranges of size and/or lastmod
The listing options are implemented by the query parameters size_min,
size_max, lastmod_start, and lastmod_end, or by the new ListOptions
type. size_min and size_max expect a number of bytes, lastmod_start
and lastmod_end expect a unix timestamp. All values are inclusive.
2023-03-17 15:15:20 +01:00

31 lines
528 B
Go

package fs
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestMemFromDir(t *testing.T) {
mem, err := NewMemFilesystemFromDir(".", MemConfig{})
require.NoError(t, err)
names := []string{}
for _, f := range mem.List("/", ListOptions{Pattern: "/*.go"}) {
names = append(names, f.Name())
}
require.ElementsMatch(t, []string{
"/disk.go",
"/fs_test.go",
"/fs.go",
"/mem_test.go",
"/mem.go",
"/readonly_test.go",
"/readonly.go",
"/s3.go",
"/sized_test.go",
"/sized.go",
}, names)
}