diff --git a/paket.lock b/paket.lock index 91ba0bff7..05e091117 100644 --- a/paket.lock +++ b/paket.lock @@ -42,9 +42,9 @@ NUGET Microsoft.SourceLink.Bitbucket.Git (>= 1.1.1) Microsoft.SourceLink.GitHub (>= 1.1.1) Microsoft.SourceLink.GitLab (>= 1.1.1) - Expecto (9.0.4) - FSharp.Core (>= 4.6) - Mono.Cecil (>= 0.11.3) + Expecto (10.1) + FSharp.Core (>= 7.0.200) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0)) + Mono.Cecil (>= 0.11.4 < 1.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0)) Expecto.Diff (9.0.4) DiffPlex (>= 1.6.3) Expecto (>= 9.0.4) @@ -485,10 +485,10 @@ NUGET System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.0)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= wp8)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.0)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= wp8)) (== netstandard2.0) (== netstandard2.1) System.Windows.Extensions (7.0) - copy_local: false, restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0)) System.Drawing.Common (>= 7.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0)) - YoloDev.Expecto.TestSdk (0.13.3) - Expecto (>= 9.0 < 10.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1)) - FSharp.Core (>= 4.6.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1)) - System.Collections.Immutable (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1)) + YoloDev.Expecto.TestSdk (0.14.2) + Expecto (>= 10.0 < 11.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0)) + FSharp.Core (>= 7.0.200) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0)) + System.Collections.Immutable (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0)) GROUP Build STORAGE: NONE diff --git a/src/FsAutoComplete.Core/TestAdapter.fs b/src/FsAutoComplete.Core/TestAdapter.fs index 69632df6b..498bbc046 100644 --- a/src/FsAutoComplete.Core/TestAdapter.fs +++ b/src/FsAutoComplete.Core/TestAdapter.fs @@ -142,7 +142,8 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = visitExpr entry expr2 | Case, SynExpr.ComputationExpr _ | Case, SynExpr.Lambda _ - | Case, SynExpr.Paren(SynExpr.Lambda _, _, _, _) -> + | Case, SynExpr.Paren(expr = SynExpr.App(argExpr = SynExpr.ComputationExpr _)) + | Case, SynExpr.Paren(expr = (SynExpr.Lambda _)) -> ident <- ident + 1 let entry = diff --git a/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs b/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs index a2fcf7de7..a958a9045 100644 --- a/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs @@ -55,5 +55,5 @@ let tests state = (async { let! testNotification = getTestNotification "ExpectoTests" "Sample.fs" Expect.hasLength testNotification.Tests 1 "Expected to have found 1 expecto test list" - Expect.hasLength testNotification.Tests.[0].Childs 13 "Expected to have found 13 expecto tests" + Expect.hasLength testNotification.Tests.[0].Childs 15 "Expected to have found 13 expecto tests" }) ] diff --git a/test/FsAutoComplete.Tests.Lsp/EmptyFileTests.fs b/test/FsAutoComplete.Tests.Lsp/EmptyFileTests.fs index d665ddd18..e5095e16e 100644 --- a/test/FsAutoComplete.Tests.Lsp/EmptyFileTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/EmptyFileTests.fs @@ -41,7 +41,7 @@ let tests state = | 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 { @@ -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 = [| { @@ -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 }) - ]] \ No newline at end of file + ]] diff --git a/test/FsAutoComplete.Tests.Lsp/Helpers.fs b/test/FsAutoComplete.Tests.Lsp/Helpers.fs index 43cb71f0e..a89fb62c5 100644 --- a/test/FsAutoComplete.Tests.Lsp/Helpers.fs +++ b/test/FsAutoComplete.Tests.Lsp/Helpers.fs @@ -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 { diff --git a/test/FsAutoComplete.Tests.Lsp/Program.fs b/test/FsAutoComplete.Tests.Lsp/Program.fs index 52d053492..6e4c9f465 100644 --- a/test/FsAutoComplete.Tests.Lsp/Program.fs +++ b/test/FsAutoComplete.Tests.Lsp/Program.fs @@ -245,14 +245,13 @@ let main args = let cts = new CancellationTokenSource(testTimeout) - let config = - { defaultConfig with - // failOnFocusedTests = true - printer = Expecto.Impl.TestPrinters.summaryWithLocationPrinter defaultConfig.printer - verbosity = logLevel - // runInParallel = false - } - - runTestsWithArgsAndCancel cts.Token config fixedUpArgs tests + let args = + [ + CLIArguments.Printer (Expecto.Impl.TestPrinters.summaryWithLocationPrinter defaultConfig.printer) + CLIArguments.Verbosity logLevel + // CLIArguments.Parallel + ] + + runTestsWithCLIArgsAndCancel cts.Token args fixedUpArgs tests diff --git a/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs b/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs index 3f1c27766..dd0e0670f 100644 --- a/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs +++ b/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs @@ -44,6 +44,14 @@ let tests = Expect.equal 4 (2+2) "2+2" } + testCaseAsync "async test case backpipe" <| async { + Expect.equal 4 (2+2) "2+2" + } + + testCaseAsync "async test case paren"(async { + Expect.equal 4 (2+2) "2+2" + }) + testTheory "odd numbers" [1; 3; 5] ( fun x -> Expect.isTrue (x % 2 = 1) "should be odd" ) diff --git a/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs b/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs index 510aa40b1..6281501f6 100644 --- a/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs +++ b/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs @@ -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"