prevent testing lib from being compiled in (#4742)

* remove testing dep from fsondisk

* code review
This commit is contained in:
Natasha Sarkar
2022-08-01 16:26:29 -05:00
committed by GitHub
parent e57b5d283f
commit bbeff6ddd6
3 changed files with 11 additions and 13 deletions

View File

@@ -58,7 +58,8 @@ func TestCleanedAbs_2(t *testing.T) {
req := require.New(t)
fSys, _ := makeTestDir(t)
root := getOSRoot(t)
root, err := getOSRoot()
req.NoError(err)
d, f, err := fSys.CleanedAbs(root)
req.NoError(err)
req.Equal(root, d.String())
@@ -122,7 +123,8 @@ func TestConfirmDirDisk(t *testing.T) {
err = os.Symlink(filepath.Join(wd, relDir), linkDir)
req.NoError(err)
root := getOSRoot(t)
root, err := getOSRoot()
req.NoError(err)
tests := map[string]*struct {
path string
expected string

View File

@@ -8,10 +8,8 @@ package filesys
import (
"path/filepath"
"testing"
)
func getOSRoot(t *testing.T) string {
t.Helper()
return string(filepath.Separator)
func getOSRoot() (string, error) {
return string(filepath.Separator), nil
}

View File

@@ -5,16 +5,14 @@ package filesys
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
"golang.org/x/sys/windows"
)
func getOSRoot(t *testing.T) string {
t.Helper()
func getOSRoot() (string, error) {
sysDir, err := windows.GetSystemDirectory()
require.NoError(t, err)
return filepath.VolumeName(sysDir) + `\`
if err != nil {
return "", err
}
return filepath.VolumeName(sysDir) + `\`, nil
}