Skip to content

Commit

Permalink
test: finder - fix the test error on Windows OS
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 4, 2023
1 parent df49e98 commit 9a94d89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
5 changes: 0 additions & 5 deletions fsutil/finder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@ func (f *Finder) CacheResult(enable ...bool) *Finder {
return f
}

// WithCacheResult cache result for find result. alias of CacheResult()
func (f *Finder) WithCacheResult(enable ...bool) *Finder {
return f.CacheResult(enable...)
}

// WithFlags set find flags.
func (f *Finder) WithFlags(flags FindFlag) *Finder {
f.c.FindFlags = flags
Expand Down
10 changes: 6 additions & 4 deletions fsutil/finder/finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,25 @@ func TestFinder_OnlyFindDir(t *testing.T) {

func TestFileFinder_NoDotFile(t *testing.T) {
f := finder.NewEmpty().
CacheResult().
ScanDir("./testdata")
assert.NotEmpty(t, f.String())

fileName := "testdata/.env"
assert.Contains(t, f.FindPaths(), fileName)
fileName := ".env"
assert.NotEmpty(t, f.FindPaths())
assert.Contains(t, f.FindNames(), fileName)

f = finder.EmptyFinder().
ScanDir("./testdata").
NoDotFile()
assert.NotContains(t, f.FindPaths(), fileName)
assert.NotContains(t, f.FindNames(), fileName)

t.Run("Not MatchDotFile", func(t *testing.T) {
f = finder.EmptyFinder().
ScanDir("./testdata").
Not(finder.MatchDotFile())

assert.NotContains(t, f.FindPaths(), fileName)
assert.NotContains(t, f.FindNames(), fileName)
})
}

Expand Down

0 comments on commit 9a94d89

Please sign in to comment.