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.
This commit is contained in:
Emil Hessman 2015-06-13 18:58:13 +02:00
parent 8b4f980123
commit 1999c83a0c
1 changed files with 6 additions and 4 deletions

View File

@ -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,
},
}