Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

lib/env: Make env_test.go support Windows

id01abeb12c6dfd1
diff --git a/lib/env/env_test.go b/lib/env/env_test.go
index 0382ecfed..9f601542a 100644
--- a/lib/env/env_test.go
+++ b/lib/env/env_test.go
@@ -2,6 +2,7 @@ package env
import (
"os"
+ "path/filepath"
"testing"
homedir "github.com/mitchellh/go-homedir"
@@ -20,10 +21,10 @@ func TestShellExpand(t *testing.T) {
in, want string
}{
{"", ""},
- {"~", home},
- {"~/dir/file.txt", home + "/dir/file.txt"},
- {"/dir/~/file.txt", "/dir/~/file.txt"},
- {"~/${EXPAND_TEST}", home + "/potato"},
+ {"~", filepath.FromSlash(home)},
+ {filepath.FromSlash("~/dir/file.txt"), filepath.FromSlash(home + "/dir/file.txt")},
+ {filepath.FromSlash("/dir/~/file.txt"), filepath.FromSlash("/dir/~/file.txt")},
+ {filepath.FromSlash("~/${EXPAND_TEST}"), filepath.FromSlash(home + "/potato")},
} {
got := ShellExpand(test.in)
assert.Equal(t, test.want, got, test.in)