18 lines
378 B
Go
18 lines
378 B
Go
package fileops
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestEnsureWorkspaceDirectoryUnderRootRejectsSymlink(t *testing.T) {
|
|
root := t.TempDir()
|
|
if err := os.Symlink(t.TempDir(), filepath.Join(root, "link")); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := EnsureWorkspaceDirectoryUnderRoot(root, "link/nested"); err == nil {
|
|
t.Fatal("accepted symlink directory")
|
|
}
|
|
}
|