Skip to content

Commit

Permalink
fix ability to debug some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Sep 17, 2023
1 parent 50572ab commit 841c093
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
10 changes: 5 additions & 5 deletions test/FsAutoComplete.Tests.Lsp/EmptyFileTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ let tests state =
[
testCaseAsync
"no parsing/checking errors"
(async {
<| async {
let! server, events, scriptPath = server1
do! server.TextDocumentDidOpen { TextDocument = loadDocument scriptPath }

match! waitForParseResultsForFile "EmptyFile.fsx" events with
| Ok _ -> () // all good, no parsing/checking errors
| Core.Result.Error errors -> failwithf "Errors while parsing script %s: %A" scriptPath errors
})
}

testCaseAsync
"auto completion does not throw and is empty"
(async {
Expand All @@ -66,7 +66,7 @@ let tests state =
(async {
let! server, events, scriptPath = server2
do! server.TextDocumentDidOpen { TextDocument = loadDocument scriptPath }

do! server.TextDocumentDidChange {
TextDocument = { Uri = Path.FilePathToUri scriptPath; Version = 1 }
ContentChanges = [| {
Expand Down Expand Up @@ -106,4 +106,4 @@ let tests state =
| Ok None -> failtest "Should have gotten some completion items"
| Error e -> failtestf "Got an error while retrieving completions: %A" e
})
]]
]]
14 changes: 9 additions & 5 deletions test/FsAutoComplete.Tests.Lsp/Helpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,15 @@ let inline expectExitCodeZero (r: BufferedCommandResult) =
0
$"Expected exit code zero but was %i{r.ExitCode}.\nStdOut: %s{r.StandardOutput}\nStdErr: %s{r.StandardError}"

let dotnetRestore dir =
runProcess dir "dotnet" "restore" |> Async.map expectExitCodeZero

let dotnetToolRestore dir =
runProcess dir "dotnet" "tool restore" |> Async.map expectExitCodeZero
let dotnetRestore dir = async {
let! r = runProcess (DirectoryInfo(dir).FullName) "dotnet" "restore -v d"
return expectExitCodeZero r
}

let dotnetToolRestore dir = async {
let! r = runProcess (DirectoryInfo(dir).FullName) "dotnet" "tool restore"
return expectExitCodeZero r
}

let serverInitialize path (config: FSharpConfigDto) createServer =
async {
Expand Down
1 change: 0 additions & 1 deletion test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ let tests state = testList (nameof(Server)) [

testSequenced <| testList "contesting" [
let projectDir = inTestCases "Project"
dotnetRestore projectDir.Value |> Async.RunSynchronously
serverTestList "dir with project and no analyzers" state noAnalyzersConfig projectDir (fun server -> [
testCaseAsync "can load file in project" (async {
let! (doc, diags) = server |> Server.openDocument "Other.fs"
Expand Down

0 comments on commit 841c093

Please sign in to comment.