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

Add integration tests #158

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04]
os: [ubuntu-24.04]
dotnet: [8.0.300]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-22.04]
os: [windows-latest, ubuntu-24.04]
dotnet: [8.0.300]
fail-fast: false

Expand Down
2 changes: 1 addition & 1 deletion src/CSharpLanguageServer/Lsp/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type CSharpLspServer(
System.Threading.TimerCallback(
fun _ -> do diagnostics.Post(ProcessPendingDiagnostics)
do stateActor.Post(PeriodicTimerTick)),
null, dueTime=1000, period=250))
null, dueTime=100, period=250))

let mutable workspaceFolders: WorkspaceFolder list = []

Expand Down
2 changes: 1 addition & 1 deletion src/CSharpLanguageServer/RoslynHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ let tryLoadSolutionFromProjectFiles
>> Log.addContext "message" (diag.ToString())
)

do! progress.End (sprintf "OK, %d project files loaded" projs.Length)
do! progress.End (sprintf "OK, %d project file(s) loaded" projs.Length)

//workspace <- Some(msbuildWorkspace :> Workspace)
return Some msbuildWorkspace.CurrentSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="Tooling.fs" />
<Compile Include="DocumentationTests.fs" />
<Compile Include="InitializationTests.fs" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions tests/CSharpLanguageServer.Tests/DocumentationTests.fs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module CSharpLanguageServer.Tests.DocumentationTests

open System

open NUnit.Framework
Expand Down
32 changes: 32 additions & 0 deletions tests/CSharpLanguageServer.Tests/InitializationTests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module CSharpLanguageServer.Tests.InitializationTests

open NUnit.Framework

open CSharpLanguageServer.Tests.Tooling

[<TestCase>]
let testServerRegistersCapabilitiesWithTheClient () =
let projectFiles =
Map.ofList [
("Project/Project.csproj",
"""<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
""");
("Project/Class.cs",
"""using System;
class Class
{
}
"""
)
]

use client = startAndMountServer projectFiles false
client.Start()
client.Initialize()
client.DumpRpcLog()
Assert.IsTrue(client.ServerDidInvoke("client/registerCapability"))

Check warning on line 32 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 8.0.300)

Main module of program is empty: nothing will happen when it is run

Check warning on line 32 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 8.0.300)

Main module of program is empty: nothing will happen when it is run

Check warning on line 32 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-24.04, 8.0.300)

Main module of program is empty: nothing will happen when it is run

Check warning on line 32 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-24.04, 8.0.300)

Main module of program is empty: nothing will happen when it is run
Loading
Loading