test: fix finder tests on windows

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-09-22 11:18:45 +02:00 committed by Márk Sági-Kazár
parent 78228f56c5
commit 237f373936
2 changed files with 4 additions and 6 deletions

8
fs.go
View file

@ -6,7 +6,7 @@ package viper
import (
"errors"
"io/fs"
"path/filepath"
"path"
)
type finder struct {
@ -18,10 +18,10 @@ type finder struct {
}
func (f finder) Find(fsys fs.FS) (string, error) {
for _, path := range f.paths {
for _, searchPath := range f.paths {
for _, fileName := range f.fileNames {
for _, extension := range f.extensions {
filePath := filepath.Join(path, fileName+"."+extension)
filePath := path.Join(searchPath, fileName+"."+extension)
ok, err := fileExists(fsys, filePath)
if err != nil {
@ -34,7 +34,7 @@ func (f finder) Find(fsys fs.FS) (string, error) {
}
if f.withoutExtension {
filePath := filepath.Join(path, fileName)
filePath := path.Join(searchPath, fileName)
ok, err := fileExists(fsys, filePath)
if err != nil {

View file

@ -13,8 +13,6 @@ import (
)
func TestFinder(t *testing.T) {
skipWindows(t)
t.Parallel()
fsys := fstest.MapFS{