1
0
Fork 0
mirror of https://github.com/Luzifer/ansible-role-version.git synced 2024-12-24 11:31:21 +00:00
ansible-role-version/vendor/gopkg.in/src-d/go-billy.v4/util/glob_test.go

35 lines
662 B
Go
Raw Normal View History

package util_test
import (
"path/filepath"
"sort"
"testing"
. "gopkg.in/check.v1"
"gopkg.in/src-d/go-billy.v4/memfs"
"gopkg.in/src-d/go-billy.v4/util"
)
func Test(t *testing.T) { TestingT(t) }
var _ = Suite(&UtilSuite{})
type UtilSuite struct{}
func (s *UtilSuite) TestCreate(c *C) {
fs := memfs.New()
util.WriteFile(fs, "foo/qux", nil, 0644)
util.WriteFile(fs, "foo/bar", nil, 0644)
util.WriteFile(fs, "foo/baz/foo", nil, 0644)
names, err := util.Glob(fs, "*/b*")
c.Assert(err, IsNil)
c.Assert(names, HasLen, 2)
sort.Strings(names)
c.Assert(names, DeepEquals, []string{
filepath.Join("foo", "bar"),
filepath.Join("foo", "baz"),
})
}