mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Move demandDirectoryRoot into kyaml/filesys (#4677)
* Move demandDirectoryRoot into kyaml/filesys * Make root directory platform-agnostic Support windows root directory. Dogfood own error package. * Use cleaner windows support implementation * Address feedback * Address feedback x2 * Re-apply go.sum changes to avoid CI errors
This commit is contained in:
@@ -16,6 +16,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const content = `
|
||||
@@ -840,6 +842,32 @@ func TestCleanedAbs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfirmDirMemRoot(t *testing.T) {
|
||||
fSys := MakeFsInMemory()
|
||||
actual, err := ConfirmDir(fSys, Separator)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, Separator, actual.String())
|
||||
}
|
||||
|
||||
func TestConfirmDirRelativeNode(t *testing.T) {
|
||||
req := require.New(t)
|
||||
fSysEmpty := MakeEmptyDirInMemory()
|
||||
|
||||
fSysRoot, err := fSysEmpty.AddDir("a")
|
||||
req.NoError(err)
|
||||
fSysSub, err := fSysRoot.AddDir("b")
|
||||
req.NoError(err)
|
||||
err = fSysSub.Mkdir("c")
|
||||
req.NoError(err)
|
||||
|
||||
expected := filepath.Join("a", "b", "c")
|
||||
req.Truef(fSysEmpty.Exists(expected), existMsg, expected)
|
||||
|
||||
actual, err := ConfirmDir(fSysSub, "c")
|
||||
req.NoError(err)
|
||||
req.Equal(expected, actual.String())
|
||||
}
|
||||
|
||||
func TestFileOps(t *testing.T) {
|
||||
const path = "foo.txt"
|
||||
content := strings.Repeat("longest content", 100)
|
||||
|
||||
Reference in New Issue
Block a user