@@ -1001,6 +1001,7 @@ findDefinitionAndHoverTests = let
1001
1001
ExpectRange expectedRange -> checkHoverRange expectedRange rangeInHover msg
1002
1002
ExpectHoverRange expectedRange -> checkHoverRange expectedRange rangeInHover msg
1003
1003
ExpectHoverText snippets -> liftIO $ traverse_ (`assertFoundIn` msg) snippets
1004
+ ExpectHoverExcludeText snippets -> liftIO $ traverse_ (`assertNotFoundIn` msg) snippets
1004
1005
ExpectHoverTextRegex re -> liftIO $ assertBool (" Regex not found in " <> T. unpack msg) (msg =~ re :: Bool )
1005
1006
ExpectNoHover -> liftIO $ assertFailure $ " Expected no hover but got " <> show hover
1006
1007
_ -> pure () -- all other expectations not relevant to hover
@@ -1029,6 +1030,11 @@ findDefinitionAndHoverTests = let
1029
1030
(T. unpack $ " failed to find: `" <> part <> " ` in hover message:\n " <> whole)
1030
1031
(part `T.isInfixOf` whole)
1031
1032
1033
+ assertNotFoundIn :: T. Text -> T. Text -> Assertion
1034
+ assertNotFoundIn part whole = assertBool
1035
+ (T. unpack $ " found unexpected: `" <> part <> " ` in hover message:\n " <> whole)
1036
+ (not . T. isInfixOf part $ whole)
1037
+
1032
1038
sourceFilePath = T. unpack sourceFileName
1033
1039
sourceFileName = " GotoHover.hs"
1034
1040
@@ -1105,6 +1111,7 @@ findDefinitionAndHoverTests = let
1105
1111
imported = Position 56 13 ; importedSig = getDocUri " Foo.hs" >>= \ foo -> return [ExpectHoverText [" foo" , " Foo" , " Haddock" ], mkL foo 5 0 5 3 ]
1106
1112
reexported = Position 55 14 ; reexportedSig = getDocUri " Bar.hs" >>= \ bar -> return [ExpectHoverText [" Bar" , " Bar" , " Haddock" ], mkL bar 3 (if ghcVersion >= GHC94 then 5 else 0 ) 3 (if ghcVersion >= GHC94 then 8 else 14 )]
1107
1113
thLocL57 = Position 59 10 ; thLoc = [ExpectHoverText [" Identity" ]]
1114
+ cmtL68 = Position 67 0 ; lackOfdEq = [ExpectHoverExcludeText [" $dEq" ]]
1108
1115
in
1109
1116
mkFindTests
1110
1117
-- def hover look expect
@@ -1148,6 +1155,7 @@ findDefinitionAndHoverTests = let
1148
1155
, test no broken chrL36 litC " literal Char in hover info #1016"
1149
1156
, test no broken txtL8 litT " literal Text in hover info #1016"
1150
1157
, test no broken lstL43 litL " literal List in hover info #1016"
1158
+ , test yes yes cmtL68 lackOfdEq " no Core symbols #3280"
1151
1159
, if ghcVersion >= GHC90 then
1152
1160
test no yes docL41 constr " type constraint in hover info #1012"
1153
1161
else
@@ -2329,6 +2337,7 @@ data Expect
2329
2337
-- | ExpectDefRange Range -- Only gotoDef should report this range
2330
2338
| ExpectHoverRange Range -- Only hover should report this range
2331
2339
| ExpectHoverText [T. Text ] -- the hover message must contain these snippets
2340
+ | ExpectHoverExcludeText [T. Text ] -- the hover message must _not_ contain these snippets
2332
2341
| ExpectHoverTextRegex T. Text -- the hover message must match this pattern
2333
2342
| ExpectExternFail -- definition lookup in other file expected to fail
2334
2343
| ExpectNoDefinitions
0 commit comments