mirror of https://github.com/miguelmota/cointop
Add boolean to UserPrefferedHomeDir to help correctly build configuration file placement and account for users with XDG_CONFIG_HOME defined
parent
a7f1e12c60
commit
b47b447748
@ -0,0 +1,22 @@
|
|||||||
|
package pathutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestNormalizePath checks that NormalizePath returns the correct directory
|
||||||
|
func TestNormalizePath(t *testing.T) {
|
||||||
|
cases := []struct {
|
||||||
|
in, want string
|
||||||
|
}{
|
||||||
|
{"~/.config/cointop/config.toml", filepath.Join(os.Getenv("XDG_CONFIG_HOME"), "/cointop/config.toml")},
|
||||||
|
}
|
||||||
|
for _, c := range cases {
|
||||||
|
got := NormalizePath(c.in)
|
||||||
|
if got != c.want {
|
||||||
|
t.Errorf("NormalizePath(%q) == %q, want %q", c.in, got, c.want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue