Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/goDocumentSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class GoplsDocumentSymbolProvider implements vscode.DocumentSymbolProvide
const start = text.indexOf(packageDecl);
pkgDeclRng = new vscode.Range(document.positionAt(start), document.positionAt(start + packageDecl.length));
pkgName = packageDecl[1];
} else if (document.fileName.endsWith('_test.gop')) {
} else if (document.fileName.endsWith('_test.gop') || document.fileName.endsWith('test.gox')) {
pkgName = 'main'; // goxls: default test pkg
}
const packageSymbol = new vscode.DocumentSymbol(
Expand Down
15 changes: 11 additions & 4 deletions src/goTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ async function _testAtCursor(
if (!editor) {
throw new NotFoundError('No editor is active.');
}
if (!editor.document.fileName.endsWith('_test.go') && !editor.document.fileName.endsWith('_test.gop')) {
if (
!editor.document.fileName.endsWith('_test.go') &&
!editor.document.fileName.endsWith('_test.gop') &&
!editor.document.fileName.endsWith('test.gox')
) {
throw new NotFoundError('No tests found. Current file is not a test file.');
}

Expand Down Expand Up @@ -210,9 +214,8 @@ async function runTestAtCursor(
if (cmd !== 'benchmark' && extractInstanceTestName(testFunctionName)) {
testConfigFns.push(...findAllTestSuiteRuns(editor.document, testFunctions).map((t) => t.name));
}

const isMod = await isModSupported(editor.document.uri);
const isGop = editor.document.fileName.endsWith('.gop'); // goxls: isGop
const isGop = editor.document.fileName.endsWith('.gop') || editor.document.fileName.endsWith('.gox'); // goxls: isGop
const testConfig: TestConfig = {
goConfig,
dir: path.dirname(editor.document.fileName),
Expand Down Expand Up @@ -381,7 +384,11 @@ export function testCurrentFile(isBenchmark: boolean, getConfig = getGoConfig):
vscode.window.showInformationMessage('No editor is active.');
return false;
}
if (!editor.document.fileName.endsWith('_test.go') && !editor.document.fileName.endsWith('_test.gop')) {
if (
!editor.document.fileName.endsWith('_test.go') &&
!editor.document.fileName.endsWith('_test.gop') &&
!editor.document.fileName.endsWith('test.gox')
) {
vscode.window.showInformationMessage('No tests found. Current file is not a test file.');
return false;
}
Expand Down