Skip to content

Commit

Permalink
expand expecto test detection
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Sep 17, 2023
1 parent 57af8fa commit 36e4c5c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/FsAutoComplete.Core/TestAdapter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry<range> 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 =
Expand Down
2 changes: 1 addition & 1 deletion test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}) ]
4 changes: 2 additions & 2 deletions test/FsAutoComplete.Tests.Lsp/EmptyFileTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ 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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" )

Expand Down

0 comments on commit 36e4c5c

Please sign in to comment.