aboutsummaryrefslogtreecommitdiffstats
path: root/queue/config_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'queue/config_test.go')
-rw-r--r--queue/config_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/queue/config_test.go b/queue/config_test.go
index 1592bb1..7cf57a2 100644
--- a/queue/config_test.go
+++ b/queue/config_test.go
@@ -1,6 +1,7 @@
package queue
import (
+ "os"
"reflect"
"strings"
"testing"
@@ -173,3 +174,27 @@ func TestSetLocalDir(t *testing.T) {
}
}
}
+
+func TestExpandUser(t *testing.T) {
+ home := "/home/foo"
+ os.Setenv("HOME", home)
+ var tests = []struct {
+ in string
+ out string
+ }{
+ {"", ""},
+ {"/d", "/d"},
+ {"~", home},
+ {"~/", home},
+ {"~bar", "/home/bar"},
+ {"~bar/baz", "/home/bar/baz"},
+ {"~/bar", home + "/bar"},
+ {"/foo/~/bar", "/foo/~/bar"},
+ }
+ for i, tt := range tests {
+ out := expandUser(tt.in)
+ if out != tt.out {
+ t.Errorf("#%d: expandUser(%q) = %q, want %q", i, tt.in, out, tt.out)
+ }
+ }
+}