Skip to content

Commit

Permalink
comment test
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleader committed Jan 5, 2024
1 parent 227b53b commit cd58b89
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions loadfile/loadfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,40 +63,39 @@ func TestLoadContext(t *testing.T) {
neededFiles = []string{
dirpath,
}
ctxFiles, err := loadfile.LoadContext(neededFiles)
_, err = loadfile.LoadContext(neededFiles)
assert.Error(t, err)
assert.Nil(t, ctxFiles)
//assert.Nil(t, ctxFiles)

// error on loading a symlink directory
neededFiles = []string{
symlinkDirpath,
}
ctxFiles, err = loadfile.LoadContext(neededFiles)
_, err = loadfile.LoadContext(neededFiles)
assert.Error(t, err)
assert.Nil(t, ctxFiles)
//assert.Nil(t, ctxFiles)

t.Cleanup(func() {
assert.NoError(t, os.RemoveAll(testdir))
})
}

// This tests AbsPathsWithContext joins relative paths with the
// context (root) directory, and passes through absolute paths
// unmodified.
// This tests AbsPathsWithContext which joins relative paths
// with the context (root) directory, and passes through
// absolute paths unmodified.
func TestContextAbsFilepaths(t *testing.T) {
testdir, err := os.MkdirTemp(os.TempDir(), "")
assert.NoError(t, err)

testFilepaths := map[string]string{
"a": "a.yaml",
"b": "/b.toml",
"c": "../rel/subdir/c.txt",
"c": "rel/../subdir/c.txt",
}

absPathsExp := map[string]string{
"a": filepath.Join(testdir, testFilepaths["a"]),
// since the 'b' file has an absolute path, it should be unmodified
"b": "/b.toml",
"b": testFilepaths["b"],
"c": filepath.Join(testdir, testFilepaths["c"]),
}

Expand Down

0 comments on commit cd58b89

Please sign in to comment.