Skip to content

Commit 523bdeb

Browse files
committed
Normalize expected path for chdir tests
The expected path comes from a simple string concatenation in shell, but `os.Getwd` appears to have the normalized working directory, so this can fail if any parent directory is a symlink.
1 parent 0426a5f commit 523bdeb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/testing/chdir/chdir.go

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ func main() {
2020
}
2121
if runtime.GOOS == "windows" {
2222
cwd = filepath.ToSlash(cwd)
23+
} else {
24+
expectDir, err = filepath.EvalSymlinks(expectDir)
25+
if err != nil {
26+
log.Fatal(err)
27+
}
2328
}
2429
if cwd != expectDir {
2530
log.Fatalf("expected:\"%v\" != os.Getwd():\"%v\"", expectDir, cwd)

0 commit comments

Comments
 (0)