Skip to content

Commit 4fc9cad

Browse files
committed
Added test for multiple files in rootDir
1 parent 824711c commit 4fc9cad

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

handler_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,34 @@ func TestLangHandler_lint_Integration(t *testing.T) {
108108
},
109109
},
110110
},
111+
{
112+
name: "multiple files in rootDir",
113+
h: &langHandler{
114+
logger: newStdLogger(false),
115+
command: []string{"golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"},
116+
rootDir: filepath.Dir("./testdata/multifile"),
117+
},
118+
filePath: "./testdata/multifile/bar.go",
119+
want: []Diagnostic{
120+
{
121+
Range: Range{
122+
Start: Position{
123+
Line: 3,
124+
Character: 4,
125+
},
126+
End: Position{
127+
Line: 3,
128+
Character: 4,
129+
},
130+
},
131+
Severity: DSWarning,
132+
Code: nil,
133+
Source: pt("unused"),
134+
Message: "unused: var `bar` is unused",
135+
RelatedInformation: nil,
136+
},
137+
},
138+
},
111139
}
112140

113141
for _, tt := range tests {

testdata/multifile/bar.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package main
2+
3+
// unused: var `bar` is unused
4+
var bar = "bar"

testdata/multifile/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package main
2+
3+
// unused: var `foo` is unused
4+
var foo = "foo"

0 commit comments

Comments
 (0)