mirror of
https://github.com/datarhei/core.git
synced 2025-10-24 00:14:03 +08:00

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.
31 lines
528 B
Go
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)
|
|
}
|