Skip to content

Commit a96fcf4

Browse files
committed
tests: neutral file paths for Windows
1 parent 4dfb61b commit a96fcf4

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

pkg/result/processors/exclusion_paths_test.go

+21-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package processors
22

33
import (
4+
"path/filepath"
45
"testing"
56

67
"github.com/stretchr/testify/assert"
@@ -39,51 +40,51 @@ func TestExclusionPaths_Process(t *testing.T) {
3940
desc: "begin with word",
4041
patterns: []string{"^foo"},
4142
issues: []result.Issue{
42-
{RelativePath: "foo.go"},
43-
{RelativePath: "foo/foo.go"},
44-
{RelativePath: "foo/bar.go"},
45-
{RelativePath: "bar/foo.go"},
46-
{RelativePath: "bar/bar.go"},
43+
{RelativePath: filepath.FromSlash("foo.go")},
44+
{RelativePath: filepath.FromSlash("foo/foo.go")},
45+
{RelativePath: filepath.FromSlash("foo/bar.go")},
46+
{RelativePath: filepath.FromSlash("bar/foo.go")},
47+
{RelativePath: filepath.FromSlash("bar/bar.go")},
4748
},
4849
expected: []result.Issue{
49-
{RelativePath: "bar/foo.go"},
50-
{RelativePath: "bar/bar.go"},
50+
{RelativePath: filepath.FromSlash("bar/foo.go")},
51+
{RelativePath: filepath.FromSlash("bar/bar.go")},
5152
},
5253
},
5354
{
5455
desc: "directory begin with word",
5556
patterns: []string{"^foo/"},
5657
issues: []result.Issue{
57-
{RelativePath: "foo.go"},
58-
{RelativePath: "foo/foo.go"},
59-
{RelativePath: "foo/bar.go"},
60-
{RelativePath: "bar/foo.go"},
61-
{RelativePath: "bar/bar.go"},
58+
{RelativePath: filepath.FromSlash("foo.go")},
59+
{RelativePath: filepath.FromSlash("foo/foo.go")},
60+
{RelativePath: filepath.FromSlash("foo/bar.go")},
61+
{RelativePath: filepath.FromSlash("bar/foo.go")},
62+
{RelativePath: filepath.FromSlash("bar/bar.go")},
6263
},
6364
expected: []result.Issue{
64-
{RelativePath: "foo.go"},
65-
{RelativePath: "bar/foo.go"},
66-
{RelativePath: "bar/bar.go"},
65+
{RelativePath: filepath.FromSlash("foo.go")},
66+
{RelativePath: filepath.FromSlash("bar/foo.go")},
67+
{RelativePath: filepath.FromSlash("bar/bar.go")},
6768
},
6869
},
6970
{
7071
desc: "same suffix with unconstrained expression",
7172
patterns: []string{"c/d.go"},
7273
issues: []result.Issue{
73-
{RelativePath: "a/b/c/d.go"},
74-
{RelativePath: "c/d.go"},
74+
{RelativePath: filepath.FromSlash("a/b/c/d.go")},
75+
{RelativePath: filepath.FromSlash("c/d.go")},
7576
},
7677
expected: []result.Issue{},
7778
},
7879
{
7980
desc: "same suffix with constrained expression",
8081
patterns: []string{"^c/d.go"},
8182
issues: []result.Issue{
82-
{RelativePath: "a/b/c/d.go"},
83-
{RelativePath: "c/d.go"},
83+
{RelativePath: filepath.FromSlash("a/b/c/d.go")},
84+
{RelativePath: filepath.FromSlash("c/d.go")},
8485
},
8586
expected: []result.Issue{
86-
{RelativePath: "a/b/c/d.go"},
87+
{RelativePath: filepath.FromSlash("a/b/c/d.go")},
8788
},
8889
},
8990
}

0 commit comments

Comments
 (0)