diff --git a/test/integrationTests/hoverProvider.integration.test.ts b/test/integrationTests/hoverProvider.integration.test.ts index 8bf863916..eec2617d0 100644 --- a/test/integrationTests/hoverProvider.integration.test.ts +++ b/test/integrationTests/hoverProvider.integration.test.ts @@ -5,6 +5,7 @@ import * as fs from 'async-file'; import * as vscode from 'vscode'; +import * as path from 'path'; import poll from './poll'; import { should, expect } from 'chai'; @@ -13,52 +14,33 @@ import { RequestQueueCollection } from '../../src/omnisharp/requestQueue'; import { OmniSharpServer } from '../../src/omnisharp/server'; import { omnisharp } from '../../src/omnisharp/extension'; -const chai = require('chai'); -chai.use(require('chai-arrays')); -chai.use(require('chai-fs')); +const chai = require('chai'); +chai.use(require('chai-arrays')); +chai.use(require('chai-fs')); -suite(`Hover Provider: ${testAssetWorkspace.description}`, function() { - suiteSetup(async function() { +suite(`Hover Provider: ${testAssetWorkspace.description}`, function () { + suiteSetup(async function () { should(); - let csharpExtension = vscode.extensions.getExtension("ms-vscode.csharp"); - if (!csharpExtension.isActive) { - await csharpExtension.activate(); + let csharpExtension = vscode.extensions.getExtension("ms-vscode.csharp"); + if (!csharpExtension.isActive) { + await csharpExtension.activate(); } await csharpExtension.exports.initializationFinished; - await omnisharp.restart(); - }); - - test("Hover returns structured documentation with proper newlines", async function () { - - let program = -`using System; -namespace Test -{ - class testissue - { - ///Checks if object is tagged with the tag. - /// The game object. - /// Name of the tag. - /// Returns true if object is tagged with tag. - - public static bool Compare(int gameObject,string tagName) - { - return true; - } - } -}`; - let fileUri = await testAssetWorkspace.projects[0].addFileWithContents("test1.cs", program); - - await omnisharp.waitForEmptyEventQueue(); - - await vscode.commands.executeCommand("vscode.open", fileUri); + }); - let c = await vscode.commands.executeCommand("vscode.executeHoverProvider", fileUri,new vscode.Position(10,29)); + test("Hover returns structured documentation with proper newlines", async function () { + let fileName = 'hover.cs'; + let dir = path.dirname(testAssetWorkspace.projects[0].projectDirectoryPath); + let loc = path.join(dir, fileName); + let fileUri = vscode.Uri.file(loc); + await omnisharp.waitForEmptyEventQueue(); - let answer:string = -`Checks if object is tagged with the tag. + await vscode.commands.executeCommand("vscode.open", fileUri); + let c = await vscode.commands.executeCommand("vscode.executeHoverProvider", fileUri, new vscode.Position(10, 29)); + let answer: string = + `Checks if object is tagged with the tag. Parameters: @@ -66,9 +48,9 @@ Parameters: \t\ttagName: Name of the tag. Returns true if object is tagged with tag.`; - expect(c[0].contents[0].value).to.equal(answer); + expect(c[0].contents[0].value).to.equal(answer); }); - + teardown(async () => { await testAssetWorkspace.cleanupWorkspace(); }); diff --git a/test/integrationTests/testAssets/singleCsproj/hover.cs b/test/integrationTests/testAssets/singleCsproj/hover.cs new file mode 100644 index 000000000..cbfc3d9d3 --- /dev/null +++ b/test/integrationTests/testAssets/singleCsproj/hover.cs @@ -0,0 +1,16 @@ +using System; +namespace Test +{ + class testissue + { + ///Checks if object is tagged with the tag. + /// The game object. + /// Name of the tag. + /// Returns true if object is tagged with tag. + + public static bool Compare(int gameObject,string tagName) + { + return true; + } + } +} \ No newline at end of file diff --git a/test/integrationTests/testAssets/slnWithCsproj/src/app/hover.cs b/test/integrationTests/testAssets/slnWithCsproj/src/app/hover.cs new file mode 100644 index 000000000..cbfc3d9d3 --- /dev/null +++ b/test/integrationTests/testAssets/slnWithCsproj/src/app/hover.cs @@ -0,0 +1,16 @@ +using System; +namespace Test +{ + class testissue + { + ///Checks if object is tagged with the tag. + /// The game object. + /// Name of the tag. + /// Returns true if object is tagged with tag. + + public static bool Compare(int gameObject,string tagName) + { + return true; + } + } +} \ No newline at end of file