Skip to content

Commit

Permalink
Add linked file FAR test
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Jul 26, 2024
1 parent e76f120 commit 89b0713
Showing 1 changed file with 58 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ void M2()
}

[Theory, CombinatorialData]
public async Task TestFindAllReferencesAsync_LargeNumberOfReferences(bool mutatingLspWorkspace, [CombinatorialRange(0, 50)] int iteration)
public async Task TestFindAllReferencesAsync_LargeNumberOfReferences(bool mutatingLspWorkspace)
{
_ = iteration;
var markup =
@"using System.Threading.Tasks
class A
Expand Down Expand Up @@ -81,4 +80,61 @@ class SomeClass{{i}}
var results = await FindAllReferencesHandlerTests.RunFindAllReferencesNonVSAsync(testLspServer, testLspServer.GetLocations("caret").First());
Assert.Equal(103, results.Length);
}

[Theory, CombinatorialData]
public async Task TestFindAllReferencesAsync_LinkedFile(bool mutatingLspWorkspace, [CombinatorialRange(0, 10)] int iteration)
{
_ = iteration;
var markup =
@"using System.Threading.Tasks
class A
{
private void SomeMethod()
{
Do({|caret:Task|}.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
Do(Task.CompletedTask);
}
}";

var workspaceXml =
$@"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""CSProj1"">
<Document FilePath=""C:\C.cs"">{markup}</Document>
</Project>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""CSProj2"">
<Document IsLinkFile=""true"" LinkFilePath=""C:\C.cs"" LinkAssemblyName=""CSProj1""></Document>
</Project>
</Workspace>";

await using var testLspServer = await CreateXmlTestLspServerAsync(workspaceXml, mutatingLspWorkspace, initializationOptions: new InitializationOptions
{
ClientCapabilities = new LSP.ClientCapabilities()
});

await WaitForWorkspaceOperationsAsync(testLspServer.TestWorkspace);

var results = await FindAllReferencesHandlerTests.RunFindAllReferencesNonVSAsync(testLspServer, testLspServer.GetLocations("caret").First());
Assert.Equal(24, results.Length);
}
}

0 comments on commit 89b0713

Please sign in to comment.