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

Fix ionide/ionide-vscode-fsharp#1906 #1152

Merged
merged 7 commits into from
Sep 1, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
More tests
Happypig375 committed Aug 13, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 506f648bf522c1c2633ec211e9fca8677a925ab7
20 changes: 14 additions & 6 deletions test/FsAutoComplete.Tests.Lsp/EmptyFileTests.fs
Original file line number Diff line number Diff line change
@@ -37,10 +37,18 @@ let tests state =
let! server, events, scriptPath = server1
do! server.TextDocumentDidOpen { TextDocument = loadDocument scriptPath }

match! waitForParseResultsForFile "EmptyFile.fsx" events with
let! parseResults = waitForParseResultsForFile "EmptyFile.fsx" events |> Async.StartChild
let! fsacResults = waitForFsacDiagnosticsForFile "EmptyFile.fsx" events |> Async.StartChild
let! compilerResults = waitForCompilerDiagnosticsForFile "EmptyFile.fsx" events |> Async.StartChild
match! parseResults with
| Ok () -> () // all good, no parsing/checking errors
| Core.Result.Error errors -> failwithf "Errors while parsing script %s: %A" scriptPath errors
do! server.TextDocumentDidClose { TextDocument = { Uri = Path.FilePathToUri scriptPath } }
match! fsacResults with
| Ok () -> () // all good, no parsing/checking errors
| Core.Result.Error errors -> failwithf "FSAC error while checking script %s: %A" scriptPath errors
match! compilerResults with
| Ok () -> () // all good, no parsing/checking errors
| Core.Result.Error errors -> failwithf "Compiler error while checking script %s: %A" scriptPath errors
})

testCaseAsync
@@ -57,9 +65,7 @@ let tests state =
{ triggerKind = CompletionTriggerKind.Invoked
triggerCharacter = None } }

let! response = server.TextDocumentCompletion completionParams

match response with
match! server.TextDocumentCompletion completionParams with
| Ok (Some _) -> failtest "An empty file has empty completions"
| Ok None -> ()
| Error e -> failtestf "Got an error while retrieving completions: %A" e
@@ -89,7 +95,9 @@ let tests state =
triggerCharacter = None }
} |> Async.StartChild

match! waitForCompilerDiagnosticsForFile "EmptyFile.fsx" events with
let! compilerResults = waitForCompilerDiagnosticsForFile "EmptyFile.fsx" events |> Async.StartChild

match! compilerResults with
| Ok () -> failtest "should get a checking error from an 'c' by itself"
| Core.Result.Error errors ->
Expect.hasLength errors 1 "should have an error FS0039: identifier not defined"