1
1
package processors
2
2
3
3
import (
4
+ "path/filepath"
4
5
"testing"
5
6
6
7
"github.com/stretchr/testify/assert"
@@ -39,11 +40,11 @@ func TestExclusionPaths_Process(t *testing.T) {
39
40
desc : "begin with word" ,
40
41
patterns : []string {"^foo" },
41
42
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" ) },
47
48
},
48
49
expected : []result.Issue {
49
50
{RelativePath : "bar/foo.go" },
@@ -54,36 +55,36 @@ func TestExclusionPaths_Process(t *testing.T) {
54
55
desc : "directory begin with word" ,
55
56
patterns : []string {"^foo/" },
56
57
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" ) },
62
63
},
63
64
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" ) },
67
68
},
68
69
},
69
70
{
70
71
desc : "same suffix with unconstrained expression" ,
71
72
patterns : []string {"c/d.go" },
72
73
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" ) },
75
76
},
76
77
expected : []result.Issue {},
77
78
},
78
79
{
79
80
desc : "same suffix with constrained expression" ,
80
81
patterns : []string {"^c/d.go" },
81
82
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" ) },
84
85
},
85
86
expected : []result.Issue {
86
- {RelativePath : "a/b/c/d.go" },
87
+ {RelativePath : filepath . FromSlash ( "a/b/c/d.go" ) },
87
88
},
88
89
},
89
90
}
0 commit comments