mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
test: fix finder tests on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
78228f56c5
commit
237f373936
2 changed files with 4 additions and 6 deletions
8
fs.go
8
fs.go
|
@ -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 {
|
||||
|
|
|
@ -13,8 +13,6 @@ import (
|
|||
)
|
||||
|
||||
func TestFinder(t *testing.T) {
|
||||
skipWindows(t)
|
||||
|
||||
t.Parallel()
|
||||
|
||||
fsys := fstest.MapFS{
|
||||
|
|
Loading…
Reference in a new issue