@@ -13,8 +13,7 @@ func pt(s string) *string {
13
13
}
14
14
15
15
func TestLangHandler_lint_Integration (t * testing.T ) {
16
- _ , err := exec .LookPath ("golangci-lint" )
17
- if err != nil {
16
+ if _ , err := exec .LookPath ("golangci-lint" ); err != nil {
18
17
t .Fatal ("golangci-lint is not installed in this environment" )
19
18
}
20
19
@@ -25,13 +24,13 @@ func TestLangHandler_lint_Integration(t *testing.T) {
25
24
want []Diagnostic
26
25
}{
27
26
{
28
- name : "simple " ,
27
+ name : "no config file " ,
29
28
h : & langHandler {
30
29
logger : newStdLogger (false ),
31
30
command : []string {"golangci-lint" , "run" , "--out-format" , "json" , "--issues-exit-code=1" },
32
- rootDir : filepath .Dir ("./testdata/simple " ),
31
+ rootDir : filepath .Dir ("./testdata/noconfig " ),
33
32
},
34
- filePath : "./testdata/simple /main.go" ,
33
+ filePath : "./testdata/noconfig /main.go" ,
35
34
want : []Diagnostic {
36
35
{
37
36
Range : Range {
@@ -53,7 +52,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
53
52
},
54
53
},
55
54
{
56
- name : "nolintername" ,
55
+ name : "nolintername option works as expected " ,
57
56
h : & langHandler {
58
57
logger : newStdLogger (false ),
59
58
command : []string {"golangci-lint" , "run" , "--out-format" , "json" , "--issues-exit-code=1" },
@@ -81,6 +80,34 @@ func TestLangHandler_lint_Integration(t *testing.T) {
81
80
},
82
81
},
83
82
},
83
+ {
84
+ name : "config file is loaded successfully" ,
85
+ h : & langHandler {
86
+ logger : newStdLogger (false ),
87
+ command : []string {"golangci-lint" , "run" , "--out-format" , "json" , "--issues-exit-code=1" },
88
+ rootDir : filepath .Dir ("./testdata/nolintername" ),
89
+ },
90
+ filePath : "./testdata/loadconfig/main.go" ,
91
+ want : []Diagnostic {
92
+ {
93
+ Range : Range {
94
+ Start : Position {
95
+ Line : 8 ,
96
+ Character : 0 ,
97
+ },
98
+ End : Position {
99
+ Line : 8 ,
100
+ Character : 0 ,
101
+ },
102
+ },
103
+ Severity : DSWarning ,
104
+ Code : nil ,
105
+ Source : pt ("wsl" ),
106
+ Message : "wsl: block should not end with a whitespace (or comment)" ,
107
+ RelatedInformation : nil ,
108
+ },
109
+ },
110
+ },
84
111
}
85
112
86
113
for _ , tt := range tests {
0 commit comments