@@ -97,7 +97,6 @@ main = do
97
97
, rootUriTests
98
98
, asyncTests
99
99
, clientSettingsTest
100
-
101
100
, codeActionHelperFunctionTests
102
101
]
103
102
@@ -1679,6 +1678,19 @@ fillTypedHoleTests = let
1679
1678
, check " replace _ with foo _"
1680
1679
" _" " n" " n"
1681
1680
" (foo _)" " n" " n"
1681
+ , testSession " replace _toException with E.toException" $ do
1682
+ let mkDoc x = T. unlines
1683
+ [ " module Testing where"
1684
+ , " import qualified Control.Exception as E"
1685
+ , " ioToSome :: E.IOException -> E.SomeException"
1686
+ , " ioToSome = " <> x ]
1687
+ doc <- createDoc " Test.hs" " haskell" $ mkDoc " _toException"
1688
+ _ <- waitForDiagnostics
1689
+ actions <- getCodeActions doc (Range (Position 3 0 ) (Position 3 maxBound ))
1690
+ chosen <- liftIO $ pickActionWithTitle " replace _toException with E.toException" actions
1691
+ executeCodeAction chosen
1692
+ modifiedCode <- documentContents doc
1693
+ liftIO $ mkDoc " E.toException" @=? modifiedCode
1682
1694
]
1683
1695
1684
1696
addInstanceConstraintTests :: TestTree
@@ -2215,7 +2227,7 @@ addSigLensesTests :: TestTree
2215
2227
addSigLensesTests = let
2216
2228
missing = " {-# OPTIONS_GHC -Wmissing-signatures -Wmissing-pattern-synonym-signatures -Wunused-matches #-}"
2217
2229
notMissing = " {-# OPTIONS_GHC -Wunused-matches #-}"
2218
- moduleH = " {-# LANGUAGE PatternSynonyms #-}\n module Sigs where"
2230
+ moduleH = " {-# LANGUAGE PatternSynonyms #-}\n module Sigs where\n import qualified Data.Complex as C "
2219
2231
other = T. unlines [" f :: Integer -> Integer" , " f x = 3" ]
2220
2232
before withMissing def
2221
2233
= T. unlines $ (if withMissing then (missing : ) else (notMissing : )) [moduleH, def, other]
@@ -2240,6 +2252,7 @@ addSigLensesTests = let
2240
2252
, sigSession enableWarnings " a >>>> b = a + b" " (>>>>) :: Num a => a -> a -> a"
2241
2253
, sigSession enableWarnings " a `haha` b = a b" " haha :: (t1 -> t2) -> t1 -> t2"
2242
2254
, sigSession enableWarnings " pattern Some a = Just a" " pattern Some :: a -> Maybe a"
2255
+ , sigSession enableWarnings " qualifiedSigTest= C.realPart" " qualifiedSigTest :: C.Complex a -> a"
2243
2256
]
2244
2257
| (title, enableWarnings) <-
2245
2258
[(" with warnings enabled" , True )
0 commit comments