Replace path package with filepath
This commit is contained in:
parent
d6f1f28db8
commit
cab3cc63bf
8 changed files with 35 additions and 43 deletions
|
|
@ -3,13 +3,13 @@ package file
|
|||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Exists expects file to exist on path constructed from pathElems and returns content of the file
|
||||
func Exists(t *testing.T, pathElems ...string) (fileContent string) {
|
||||
modelFilePath := path.Join(pathElems...)
|
||||
modelFilePath := filepath.Join(pathElems...)
|
||||
file, err := os.ReadFile(modelFilePath) // #nosec G304
|
||||
require.Nil(t, err)
|
||||
require.NotEmpty(t, file)
|
||||
|
|
@ -18,7 +18,7 @@ func Exists(t *testing.T, pathElems ...string) (fileContent string) {
|
|||
|
||||
// NotExists expects file not to exist on path constructed from pathElems
|
||||
func NotExists(t *testing.T, pathElems ...string) {
|
||||
modelFilePath := path.Join(pathElems...)
|
||||
modelFilePath := filepath.Join(pathElems...)
|
||||
_, err := os.ReadFile(modelFilePath) // #nosec G304
|
||||
require.True(t, os.IsNotExist(err))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue