Run windows valid path test cases only if runtime.GOOS == "windows"

This commit is contained in:
Elliot Morrison-Reed 2016-08-26 18:11:33 +02:00
parent 6296a316b8
commit 895387ad4b

View file

@ -52,28 +52,23 @@ func TestInPath(t *testing.T) {
{"/bar/foo", "/bar/foo/baz", true},
{"/bar/foo/baz", "/bar/foo", false},
{"/bar/foo", "/bar/foo/.wierd..dirname/", true},
{"c:\\bar\\foo", "C:\\bar\\foo", false},
{"c:\\bar\\..\\bar\\foo", "C:\\bar\\foo\\baz", true},
}
if runtime.GOOS == "windows" {
cases = append(
cases,
inPathTestCase{"C:/Bar/foo", "c:/bar/foo/baz", true},
)
} else {
cases = append(
cases,
inPathTestCase{"C:/Bar/foo", "c:/bar/foo/baz", false},
inPathTestCase{"c:\\bar\\foo", "C:\\bar\\foo", false},
inPathTestCase{"c:\\bar\\..\\bar\\foo", "C:\\bar\\foo\\baz", true},
)
}
for _, tc := range cases {
ip := inPath(tc.Src, tc.Prj)
if tc.InPath != ip {
if tc.InPath {
t.Errorf("Unexpected %s determined as inside %s", tc.Prj, tc.Src)
} else {
if ip {
t.Errorf("Unexpected %s determined as not inside %s", tc.Prj, tc.Src)
} else {
t.Errorf("Unexpected %s determined as inside %s", tc.Prj, tc.Src)
}
}
}