Debian Codegraph @

util/glob_test.go

raw symbols SCIP
1 package util_test
2
3 import (
4 "path/filepath"
5 "sort"
6 "testing"
7
8 . "gopkg.in/check.v1"
9 "github.com/go-git/go-billy/v5/memfs"
10 "github.com/go-git/go-billy/v5/util"
11 )
12
13 func Test(t *testing.T) { TestingT(t) }
14
15 var _ = Suite(&UtilSuite{})
16
17 type UtilSuite struct{}
18
19 func (s *UtilSuite) TestCreate(c *C) {
20 fs := memfs.New()
21 util.WriteFile(fs, "foo/qux", nil, 0644)
22 util.WriteFile(fs, "foo/bar", nil, 0644)
23 util.WriteFile(fs, "foo/baz/foo", nil, 0644)
24
25 names, err := util.Glob(fs, "*/b*")
26 c.Assert(err, IsNil)
27 c.Assert(names, HasLen, 2)
28 sort.Strings(names)
29 c.Assert(names, DeepEquals, []string{
30 filepath.Join("foo", "bar"),
31 filepath.Join("foo", "baz"),
32 })
33
34 }