Add glob support in edit add resource

This commit is contained in:
Jingfang Liu
2018-07-31 10:58:14 -07:00
parent 6a834b6262
commit 1b7171ac9e
10 changed files with 84 additions and 83 deletions

View File

@@ -18,6 +18,7 @@ package fs
import (
"bytes"
"reflect"
"testing"
)
@@ -90,3 +91,20 @@ func TestWriteFile(t *testing.T) {
t.Fatalf("incorrect content: %v", content)
}
}
func TestGlob(t *testing.T) {
x := MakeFakeFS()
x.Create("dir/foo")
x.Create("dir/bar")
files, err := x.Glob("dir/*")
if err != nil {
t.Fatalf("expected no error")
}
expected := []string{
"dir/bar",
"dir/foo",
}
if !reflect.DeepEqual(files, expected) {
t.Fatalf("incorrect files found by glob: %v", files)
}
}