From 1999c83a0c00ec7e1ad6a06ce76b544ab2e7897f Mon Sep 17 00:00:00 2001 From: Emil Hessman Date: Sat, 13 Jun 2015 18:58:13 +0200 Subject: [PATCH] post-processor/atlas: adjust test for cross-platform filepath separator Make TestLongestCommonPrefix cross-platform friendly by defining the test cases with filepath.Separator. Fixes test failure on Windows. --- post-processor/atlas/util_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/post-processor/atlas/util_test.go b/post-processor/atlas/util_test.go index b6b9da3d9..d0bed0a5d 100644 --- a/post-processor/atlas/util_test.go +++ b/post-processor/atlas/util_test.go @@ -1,10 +1,12 @@ package atlas import ( + "path/filepath" "testing" ) func TestLongestCommonPrefix(t *testing.T) { + sep := string(filepath.Separator) cases := []struct { Input []string Output string @@ -18,12 +20,12 @@ func TestLongestCommonPrefix(t *testing.T) { "", }, { - []string{"foo/", "foo/bar"}, - "foo/", + []string{"foo" + sep, "foo" + sep + "bar"}, + "foo" + sep, }, { - []string{"/foo/", "/bar"}, - "/", + []string{sep + "foo" + sep, sep + "bar"}, + sep, }, }