From 993a9015e88ac81753aa1d1299772e997ffa8a93 Mon Sep 17 00:00:00 2001 From: Eli Dowling Date: Wed, 25 May 2022 09:23:59 +1000 Subject: [PATCH] Added test for DU hover fix --- sample/MainProject/Hover.fs | 5 ++++- tests/Expecto/FsharpLanguageServer/ServerTests.fs | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sample/MainProject/Hover.fs b/sample/MainProject/Hover.fs index 565608c..bb637f4 100644 --- a/sample/MainProject/Hover.fs +++ b/sample/MainProject/Hover.fs @@ -22,4 +22,7 @@ let aliasedFunc:intFunc = (multiply 1 2) ///``b``: b thing let docedFunction a b= a+b -let methodTest=Authorization("a") \ No newline at end of file +let methodTest=Authorization("a") + +type DUHover= + |HoverCase of string \ No newline at end of file diff --git a/tests/Expecto/FsharpLanguageServer/ServerTests.fs b/tests/Expecto/FsharpLanguageServer/ServerTests.fs index ccc1420..85a5c6f 100644 --- a/tests/Expecto/FsharpLanguageServer/ServerTests.fs +++ b/tests/Expecto/FsharpLanguageServer/ServerTests.fs @@ -216,6 +216,13 @@ let serverTests= | None -> failtest "noHover" | Some hover -> Expect.isNonEmpty hover.contents "Hover list is empty" } + //See issue #106 + test "hover over DU aginst pipe" { + let client, server = createServerAndReadFile("MainProject", "Hover.fs") + match server.Hover(textDocumentPosition("MainProject", "Hover.fs", 28, 10)) |> Async.RunSynchronously with + | None -> failtest "No hover" + | Some hover -> Expect.isNonEmpty hover.contents "Hover list is empty" + } let labels(items: CompletionItem list) = [for i in items do yield i.label] @@ -425,7 +432,7 @@ let serverTests= test "report no type errors in CSharp reference" { let client, server = createServerAndReadFile("ReferenceCSharp", "Library.fs") let messages = diagnosticMessages(client) - Expect.isEmpty messages "got type errors" + Expect.isEmpty messages (sprintf "got type errors: %A" messages) } test "Report no errors opening project using net6.0-windows framework" { //This test is to fix issues with net6.0-windows and isssues discovering frameworks that should be imported based on packages.