From 831e936846920b395dddd584b76e2b9f6b7c18a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 23 Nov 2015 16:32:06 +0100 Subject: Improve "watching for ..." logging --- helpers/path_test.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'helpers/path_test.go') 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) + } } } -- cgit v1.2.3