summaryrefslogtreecommitdiffstats
path: root/helpers/path_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2015-11-23 16:32:06 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2015-11-23 16:32:06 +0100
commit831e936846920b395dddd584b76e2b9f6b7c18a1 (patch)
treeac6a43821e195186cbae008e3965643236b23d5d /helpers/path_test.go
parent098a0c819af2575628690517f4bd40253d7436d7 (diff)
Improve "watching for ..." logging
Diffstat (limited to 'helpers/path_test.go')
-rw-r--r--helpers/path_test.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/helpers/path_test.go b/helpers/path_test.go
index 9534cf9c1..a1d897df9 100644
--- a/helpers/path_test.go
+++ b/helpers/path_test.go
@@ -625,11 +625,19 @@ func TestPrettifyPath(t *testing.T) {
}
-func TestRemoveSubpaths(t *testing.T) {
- got := RemoveSubpaths([]string{"hello", "hello/world", "foo/bar", ""})
- expect := []string{"hello", "foo/bar"}
- if !reflect.DeepEqual(got, expect) {
- t.Errorf("Expected %q but got %q", expect, got)
+func TestExtractRootPaths(t *testing.T) {
+ tests := []struct {
+ input []string
+ expected []string
+ }{{[]string{filepath.FromSlash("a/b"), filepath.FromSlash("a/b/c/"), "b",
+ filepath.FromSlash("/c/d"), filepath.FromSlash("d/"), filepath.FromSlash("//e//")},
+ []string{"a", "a", "b", "c", "d", "e"}}}
+
+ for _, test := range tests {
+ output := ExtractRootPaths(test.input)
+ if !reflect.DeepEqual(output, test.expected) {
+ t.Errorf("Expected %#v, got %#v\n", test.expected, output)
+ }
}
}