clean paths in test comparisons

This commit is contained in:
Albert Z Wang 2017-11-29 14:01:03 -05:00
parent c5621b3590
commit 4f332f79e7
1 changed files with 3 additions and 3 deletions

View File

@ -151,7 +151,7 @@ func TestBasePathOpenFile(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed to open file: %v", err) t.Fatalf("failed to open file: %v", err)
} }
if filepath.Dir(f.Name()) != "/tmp" { if filepath.Dir(f.Name()) != filepath.Clean("/tmp") {
t.Fatalf("realpath leaked: %s", f.Name()) t.Fatalf("realpath leaked: %s", f.Name())
} }
} }
@ -164,7 +164,7 @@ func TestBasePathCreate(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed to create file: %v", err) t.Fatalf("failed to create file: %v", err)
} }
if filepath.Dir(f.Name()) != "/tmp" { if filepath.Dir(f.Name()) != filepath.Clean("/tmp") {
t.Fatalf("realpath leaked: %s", f.Name()) t.Fatalf("realpath leaked: %s", f.Name())
} }
} }
@ -179,7 +179,7 @@ func TestBasePathTempFile(t *testing.T) {
t.Fatalf("Failed to TempDir: %v", err) t.Fatalf("Failed to TempDir: %v", err)
} }
fmt.Println(tDir) fmt.Println(tDir)
if filepath.Dir(tDir) != "/tmp" { if filepath.Dir(tDir) != filepath.Clean("/tmp") {
t.Fatalf("Tempdir realpath leaked: %s", tDir) t.Fatalf("Tempdir realpath leaked: %s", tDir)
} }
tempFile, err := TempFile(bp, tDir, "") tempFile, err := TempFile(bp, tDir, "")