Merge pull request #14 from leighmcculloch/windows-test-fix
Use path/filepath over hardcoded path separators.
diff --git a/homedir_test.go b/homedir_test.go
index c34dbc7..e4054e7 100644
--- a/homedir_test.go
+++ b/homedir_test.go
@@ -1,9 +1,9 @@
package homedir
import (
- "fmt"
"os"
"os/user"
+ "path/filepath"
"testing"
)
@@ -64,7 +64,7 @@
{
"~/foo",
- fmt.Sprintf("%s/foo", u.HomeDir),
+ filepath.Join(u.HomeDir, "foo"),
false,
},
@@ -101,12 +101,12 @@
DisableCache = true
defer func() { DisableCache = false }()
defer patchEnv("HOME", "/custom/path/")()
- expected := "/custom/path/foo/bar"
+ expected := filepath.Join("/", "custom", "path", "foo/bar")
actual, err := Expand("~/foo/bar")
if err != nil {
t.Errorf("No error is expected, got: %v", err)
- } else if actual != "/custom/path/foo/bar" {
+ } else if actual != expected {
t.Errorf("Expected: %v; actual: %v", expected, actual)
}
}