Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make hover test run by adding the file in the project #2058

Merged
merged 4 commits into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
61 changes: 22 additions & 39 deletions test/integrationTests/hoverProvider.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -13,62 +14,44 @@ 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
{
///<summary>Checks if object is tagged with the tag.</summary>
/// <param name="gameObject">The game object.</param>
/// <param name="tagName">Name of the tag.</param>
/// <returns>Returns <c>true</c> if object is tagged with tag.</returns>

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:

\t\tgameObject: The game object.
\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();
});
Expand Down
16 changes: 16 additions & 0 deletions test/integrationTests/testAssets/singleCsproj/hover.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
namespace Test
{
class testissue
{
///<summary>Checks if object is tagged with the tag.</summary>
/// <param name="gameObject">The game object.</param>
/// <param name="tagName">Name of the tag.</param>
/// <returns>Returns <c>true</c> if object is tagged with tag.</returns>

public static bool Compare(int gameObject,string tagName)
{
return true;
}
}
}
16 changes: 16 additions & 0 deletions test/integrationTests/testAssets/slnWithCsproj/src/app/hover.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
namespace Test
{
class testissue
{
///<summary>Checks if object is tagged with the tag.</summary>
/// <param name="gameObject">The game object.</param>
/// <param name="tagName">Name of the tag.</param>
/// <returns>Returns <c>true</c> if object is tagged with tag.</returns>

public static bool Compare(int gameObject,string tagName)
{
return true;
}
}
}