@@ -4254,6 +4254,7 @@ findDefinitionAndHoverTests = let
42544254 ExpectRange expectedRange -> checkHoverRange expectedRange rangeInHover msg
42554255 ExpectHoverRange expectedRange -> checkHoverRange expectedRange rangeInHover msg
42564256 ExpectHoverText snippets -> liftIO $ traverse_ (`assertFoundIn` msg) snippets
4257+ ExpectHoverTextRegex re -> liftIO $ assertBool (" Regex not found in " <> T. unpack msg) (msg =~ re :: Bool )
42574258 ExpectNoHover -> liftIO $ assertFailure $ " Expected no hover but got " <> show hover
42584259 _ -> pure () -- all other expectations not relevant to hover
42594260 _ -> liftIO $ assertFailure $ " test not expecting this kind of hover info" <> show hover
@@ -4344,11 +4345,10 @@ findDefinitionAndHoverTests = let
43444345 innL48 = Position 52 5 ; innSig = [ExpectHoverText [" inner" , " Char" ], mkR 49 2 49 7 ]
43454346 holeL60 = Position 62 7 ; hleInfo = [ExpectHoverText [" _ ::" ]]
43464347 holeL65 = Position 65 8 ; hleInfo2 = [ExpectHoverText [" _ :: a -> Maybe a" ]]
4347- cccL17 = Position 17 16 ; docLink = [ExpectHoverText [ " [Documentation](file:/// " ] ]
4348+ cccL17 = Position 17 16 ; docLink = [ExpectHoverTextRegex " \\ *Defined in 'GHC.Types' \\ * \\ * \\ (ghc-prim-[0-9.]+ \\ ) \\ * \n\n " ]
43484349 imported = Position 56 13 ; importedSig = getDocUri " Foo.hs" >>= \ foo -> return [ExpectHoverText [" foo" , " Foo" , " Haddock" ], mkL foo 5 0 5 3 ]
43494350 reexported = Position 55 14 ; reexportedSig = getDocUri " Bar.hs" >>= \ bar -> return [ExpectHoverText [" Bar" , " Bar" , " Haddock" ], mkL bar 3 0 3 14 ]
43504351 thLocL57 = Position 59 10 ; thLoc = [ExpectHoverText [" Identity" ]]
4351- doc36 = Position 36 20 ; multiDoc = [ExpectHoverText [" \n\n [Documentation](file:///" ]]
43524352 in
43534353 mkFindTests
43544354 -- def hover look expect
@@ -4400,7 +4400,7 @@ findDefinitionAndHoverTests = let
44004400 , test broken broken innL48 innSig " inner signature #767"
44014401 , test no yes holeL60 hleInfo " hole without internal name #831"
44024402 , test no yes holeL65 hleInfo2 " hole with variable"
4403- , test no skip cccL17 docLink " Haddock html links"
4403+ , test no yes cccL17 docLink " Haddock html links"
44044404 , testM yes yes imported importedSig " Imported symbol"
44054405 , testM yes yes reexported reexportedSig " Imported symbol (reexported)"
44064406 , if | ghcVersion == GHC90 && isWindows ->
@@ -4411,7 +4411,6 @@ findDefinitionAndHoverTests = let
44114411 test no broken thLocL57 thLoc " TH Splice Hover"
44124412 | otherwise ->
44134413 test no yes thLocL57 thLoc " TH Splice Hover"
4414- , test yes yes doc36 multiDoc " two newlines before document"
44154414 ]
44164415 where yes, broken :: (TestTree -> Maybe TestTree )
44174416 yes = Just -- test should run and pass
@@ -5745,6 +5744,7 @@ data Expect
57455744-- | ExpectDefRange Range -- Only gotoDef should report this range
57465745 | ExpectHoverRange Range -- Only hover should report this range
57475746 | ExpectHoverText [T. Text ] -- the hover message must contain these snippets
5747+ | ExpectHoverTextRegex T. Text -- the hover message must match this pattern
57485748 | ExpectExternFail -- definition lookup in other file expected to fail
57495749 | ExpectNoDefinitions
57505750 | ExpectNoHover
0 commit comments