mirror of
https://github.com/Luzifer/ansible-role-version.git
synced 2024-12-24 19:41:20 +00:00
34 lines
662 B
Go
34 lines
662 B
Go
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"),
|
|
})
|
|
|
|
}
|