From 4edbebd8b00409da456655e2361f599971cd41f5 Mon Sep 17 00:00:00 2001 From: Victor Freire <25647735+ratsclub@users.noreply.github.com> Date: Wed, 19 Apr 2023 13:41:38 -0300 Subject: [PATCH] Handle Expecto's Task tests (#1105) --- src/FsAutoComplete.Core/TestAdapter.fs | 6 ++++++ test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs | 2 +- .../TestCases/ExpectoTests/Sample.fs | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/FsAutoComplete.Core/TestAdapter.fs b/src/FsAutoComplete.Core/TestAdapter.fs index 622d89723..694861fa1 100644 --- a/src/FsAutoComplete.Core/TestAdapter.fs +++ b/src/FsAutoComplete.Core/TestAdapter.fs @@ -50,6 +50,9 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = || str.EndsWith "testCaseAsync" || str.EndsWith "ftestCaseAsync" || str.EndsWith "ptestCaseAsync" + || str.EndsWith "testCaseTask" + || str.EndsWith "ftestCaseTask" + || str.EndsWith "ptestCaseTask" || (str.EndsWith "test" && not (str.EndsWith "failtest") && not (str.EndsWith "skiptest")) @@ -58,6 +61,9 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = || str.EndsWith "testAsync" || str.EndsWith "ftestAsync" || str.EndsWith "ptestAsync" + || str.EndsWith "testTask" + || str.EndsWith "ftestTask" + || str.EndsWith "ptestTask" || str.EndsWith "testProperty" || str.EndsWith "ptestProperty" || str.EndsWith "ftestProperty" diff --git a/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs b/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs index 1b57357df..0f7ad3f32 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 8 "Expected to have found 8 expecto tests" + Expect.hasLength testNotification.Tests.[0].Childs 10 "Expected to have found 10 expecto tests" }) ] diff --git a/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs b/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs index e38ed22c1..d318fa20a 100644 --- a/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs +++ b/test/FsAutoComplete.Tests.Lsp/TestCases/ExpectoTests/Sample.fs @@ -1,5 +1,6 @@ module Tests +open System.Threading.Tasks open Expecto [] @@ -33,4 +34,13 @@ let tests = test "I am (should fail)" { "╰〳 ಠ 益 ಠೃ 〵╯" |> Expect.equal true false } + + testTask "simple task" { + do! Task.Delay 1 + Expect.equal 1 1 "1=1" + } + + testAsync "simple async" { + Expect.equal 4 (2+2) "2+2" + } ]