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

Commit

Permalink
Adding tests for definition provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Nov 17, 2016
1 parent 0020119 commit aa102a8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/go.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as vscode from 'vscode';
import { GoHoverProvider } from '../src/goExtraInfo';
import { GoCompletionItemProvider } from '../src/goSuggest';
import { GoSignatureHelpProvider } from '../src/goSignature';
import { GoDefinitionProvider } from '../src/goDeclaration';
import { check } from '../src/goCheck';
import cp = require('child_process');
import { getEditsFromUnifiedDiffStr, getEdits } from '../src/diffUtils';
Expand Down Expand Up @@ -44,6 +45,21 @@ suite('Go Extension Tests', () => {
fs.removeSync(repoPath);
});

test('Test Definition Provider', (done) => {
let provider = new GoDefinitionProvider();
let uri = vscode.Uri.file(path.join(fixturePath, 'test.go'));
let position = new vscode.Position(10, 3);
vscode.workspace.openTextDocument(uri).then((textDocument) => {
return provider.provideDefinition(textDocument, position, null).then(definitionInfo => {
assert.equal(definitionInfo.uri.path, uri.path, `${definitionInfo.uri.path} is not the same as ${uri.path}`);
});
}, (err) => {
assert.ok(false, `error in OpenTextDocument ${err}`);
}).then(() => done(), done);

});


test('Test Hover Provider', (done) => {
let provider = new GoHoverProvider();
let printlnDoc = `Println formats using the default formats for its operands and writes to
Expand Down

0 comments on commit aa102a8

Please sign in to comment.