Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Fixes #303 Dont run test if current file is not test file
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jan 13, 2017
1 parent 99c0398 commit a46f313
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/goTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export function testAtCursor(goConfig: vscode.WorkspaceConfiguration) {
vscode.window.showInformationMessage('No editor is active.');
return;
}
if (!editor.document.fileName.endsWith('_test.go')) {
vscode.window.showInformationMessage('No tests found. Current file is not a test file.');
return;
}
getTestFunctions(editor.document).then(testFunctions => {
let testFunction: vscode.SymbolInformation;
// Find any test function containing the cursor.
Expand Down Expand Up @@ -105,6 +109,10 @@ export function testCurrentFile(goConfig: vscode.WorkspaceConfiguration): Thenab
vscode.window.showInformationMessage('No editor is active.');
return;
}
if (!editor.document.fileName.endsWith('_test.go')) {
vscode.window.showInformationMessage('No tests found. Current file is not a test file.');
return;
}
return getTestFunctions(editor.document).then(testFunctions => {
return goTest({
goConfig: goConfig,
Expand Down

0 comments on commit a46f313

Please sign in to comment.