Skip to content

Commit e63f1ad

Browse files
nirhaashyangah
authored andcommitted
add support for multi-file test suite
When collecting tests or evaluating whether a symbol is a test for CodeLens, check if testify was imported by any file of the directory (which is the go package). Not sure whether this is the optimal / recommended way of dealing with this, but here goes. Fixes #1130 Change-Id: I4e66f0d319604a7300116240c24b60dcdd37bf81 GitHub-Last-Rev: efc72ad GitHub-Pull-Request: #2314 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/415894 TryBot-Result: kokoro <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
1 parent 05edb9c commit e63f1ad

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/goDocumentSymbols.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,5 @@ async function listImports(
102102
]
103103
};
104104
const resp = await languageClient?.sendRequest(ExecuteCommandRequest.type, params);
105-
return resp.Imports;
105+
return resp.PackageImports;
106106
}

src/testUtils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ export async function getTestFunctions(
158158
return;
159159
}
160160
const children = symbol.children;
161+
162+
// With gopls dymbol provider symbols, the symbols have the imports of all
163+
// the package, so suite tests from all files will be found.
161164
const testify = importsTestify(symbols);
162165
return children.filter(
163166
(sym) =>

0 commit comments

Comments
 (0)