@@ -103,7 +103,6 @@ initializeTests = withResource acquire release tests
103
103
acquire :: IO (TResponseMessage Method_Initialize )
104
104
acquire = run initializeResponse
105
105
106
-
107
106
release :: TResponseMessage Method_Initialize -> IO ()
108
107
release = const $ pure ()
109
108
@@ -262,7 +261,7 @@ completionTests =
262
261
]
263
262
]
264
263
265
- completionCommandTest :: String -> [T. Text ] -> Position -> T. Text -> [T. Text ] -> TestTree
264
+ completionCommandTest :: TestName -> [T. Text ] -> Position -> T. Text -> [T. Text ] -> TestTree
266
265
completionCommandTest name src pos wanted expected = testSession name $ do
267
266
docId <- createDoc " A.hs" " haskell" (T. unlines src)
268
267
_ <- waitForDiagnostics
@@ -286,7 +285,7 @@ completionCommandTest name src pos wanted expected = testSession name $ do
286
285
expectMessages SMethod_WorkspaceApplyEdit 1 $ \ edit ->
287
286
liftIO $ assertFailure $ " Expected no edit but got: " <> show edit
288
287
289
- completionNoCommandTest :: String -> [T. Text ] -> Position -> T. Text -> TestTree
288
+ completionNoCommandTest :: TestName -> [T. Text ] -> Position -> T. Text -> TestTree
290
289
completionNoCommandTest name src pos wanted = testSession name $ do
291
290
docId <- createDoc " A.hs" " haskell" (T. unlines src)
292
291
_ <- waitForDiagnostics
@@ -544,13 +543,13 @@ importQualifiedTests = testGroup "import qualified prefix suggestions"
544
543
[" import qualified Control.Monad as Control" , " import Control.Monad (when)" ]
545
544
]
546
545
547
- checkImport :: String -> FilePath -> FilePath -> T. Text -> TestTree
548
- checkImport testComment originalPath expectedPath action =
549
- checkImport' testComment originalPath expectedPath action []
546
+ checkImport :: TestName -> FilePath -> FilePath -> T. Text -> TestTree
547
+ checkImport testName originalPath expectedPath action =
548
+ checkImport' testName originalPath expectedPath action []
550
549
551
- checkImport' :: String -> FilePath -> FilePath -> T. Text -> [T. Text ] -> TestTree
552
- checkImport' testComment originalPath expectedPath action excludedActions =
553
- testSessionWithExtraFiles " import-placement" testComment $ \ dir ->
550
+ checkImport' :: TestName -> FilePath -> FilePath -> T. Text -> [T. Text ] -> TestTree
551
+ checkImport' testName originalPath expectedPath action excludedActions =
552
+ testSessionWithExtraFiles " import-placement" testName $ \ dir ->
554
553
check (dir </> originalPath) (dir </> expectedPath) action
555
554
where
556
555
check :: FilePath -> FilePath -> T. Text -> Session ()
@@ -631,7 +630,7 @@ renameActionTests = testGroup "rename actions"
631
630
]
632
631
]
633
632
where
634
- check :: String -> [T. Text ] -> (T. Text , Range ) -> [T. Text ] -> TestTree
633
+ check :: TestName -> [T. Text ] -> (T. Text , Range ) -> [T. Text ] -> TestTree
635
634
check testName linesOrig (actionTitle, actionRange) linesExpected =
636
635
testSession testName $ do
637
636
let contentBefore = T. unlines linesOrig
@@ -2402,14 +2401,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2402
2401
[ (DiagnosticSeverity_Warning , (6 , 8 ), " Defaulting the following constraint" )
2403
2402
, (DiagnosticSeverity_Warning , (6 , 16 ), " Defaulting the following constraint" )
2404
2403
])
2405
- ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2404
+ " Add type annotation ‘String ’ to ‘\" debug\" ’"
2406
2405
[ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2407
2406
, " {-# LANGUAGE OverloadedStrings #-}"
2408
2407
, " module A (f) where"
2409
2408
, " "
2410
2409
, " import Debug.Trace"
2411
2410
, " "
2412
- , " f = seq (\" debug\" :: " <> listOfChar <> " ) traceShow \" debug\" "
2411
+ , " f = seq (\" debug\" :: String ) traceShow \" debug\" "
2413
2412
]
2414
2413
, testSession " add default type to satisfy two constraints" $
2415
2414
testFor
@@ -2424,14 +2423,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2424
2423
(if ghcVersion >= GHC94
2425
2424
then [ (DiagnosticSeverity_Warning , (6 , 6 ), " Defaulting the type variable" ) ]
2426
2425
else [ (DiagnosticSeverity_Warning , (6 , 6 ), " Defaulting the following constraint" ) ])
2427
- ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2426
+ " Add type annotation ‘String ’ to ‘\" debug\" ’"
2428
2427
[ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2429
2428
, " {-# LANGUAGE OverloadedStrings #-}"
2430
2429
, " module A (f) where"
2431
2430
, " "
2432
2431
, " import Debug.Trace"
2433
2432
, " "
2434
- , " f a = traceShow (\" debug\" :: " <> listOfChar <> " ) a"
2433
+ , " f a = traceShow (\" debug\" :: String ) a"
2435
2434
]
2436
2435
, testSession " add default type to satisfy two constraints with duplicate literals" $
2437
2436
testFor
@@ -2446,14 +2445,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2446
2445
(if ghcVersion >= GHC94
2447
2446
then [ (DiagnosticSeverity_Warning , (6 , 54 ), " Defaulting the type variable" ) ]
2448
2447
else [ (DiagnosticSeverity_Warning , (6 , 54 ), " Defaulting the following constraint" ) ])
2449
- ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2448
+ " Add type annotation ‘String ’ to ‘\" debug\" ’"
2450
2449
[ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2451
2450
, " {-# LANGUAGE OverloadedStrings #-}"
2452
2451
, " module A (f) where"
2453
2452
, " "
2454
2453
, " import Debug.Trace"
2455
2454
, " "
2456
- , " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow (\" debug\" :: " <> listOfChar <> " )))"
2455
+ , " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow (\" debug\" :: String )))"
2457
2456
]
2458
2457
]
2459
2458
where
@@ -2520,20 +2519,19 @@ fillTypedHoleTests = let
2520
2519
sourceCode :: T. Text -> T. Text -> T. Text -> T. Text
2521
2520
sourceCode a b c = T. unlines
2522
2521
[ " module Testing where"
2523
- , " "
2524
- , " globalConvert :: Int -> String"
2525
- , " globalConvert = undefined"
2526
- , " "
2527
- , " globalInt :: Int"
2528
- , " globalInt = 3"
2529
- , " "
2530
- , " bar :: Int -> Int -> String"
2531
- , " bar n parameterInt = " <> a <> " (n + " <> b <> " + " <> c <> " ) where"
2532
- , " localConvert = (flip replicate) 'x'"
2533
- , " "
2534
- , " foo :: () -> Int -> String"
2535
- , " foo = undefined"
2536
-
2522
+ , " "
2523
+ , " globalConvert :: Int -> String"
2524
+ , " globalConvert = undefined"
2525
+ , " "
2526
+ , " globalInt :: Int"
2527
+ , " globalInt = 3"
2528
+ , " "
2529
+ , " bar :: Int -> Int -> String"
2530
+ , " bar n parameterInt = " <> a <> " (n + " <> b <> " + " <> c <> " ) where"
2531
+ , " localConvert = (flip replicate) 'x'"
2532
+ , " "
2533
+ , " foo :: () -> Int -> String"
2534
+ , " foo = undefined"
2537
2535
]
2538
2536
2539
2537
check :: T. Text -> T. Text -> T. Text -> T. Text -> T. Text -> T. Text -> T. Text -> TestTree
@@ -2818,7 +2816,7 @@ addFunctionConstraintTests = let
2818
2816
(missingMonadConstraint " Monad m => " )
2819
2817
]
2820
2818
2821
- checkCodeAction :: String -> T. Text -> T. Text -> T. Text -> TestTree
2819
+ checkCodeAction :: TestName -> T. Text -> T. Text -> T. Text -> TestTree
2822
2820
checkCodeAction testName actionTitle originalCode expectedCode = testSession testName $ do
2823
2821
doc <- createDoc " Testing.hs" " haskell" originalCode
2824
2822
_ <- waitForDiagnostics
@@ -3659,7 +3657,7 @@ extendImportTestsRegEx = testGroup "regex parsing"
3659
3657
pickActionWithTitle :: T. Text -> [Command |? CodeAction ] -> Session CodeAction
3660
3658
pickActionWithTitle title actions =
3661
3659
case matches of
3662
- [] -> liftIO . assertFailure $ " CodeAction with title ' " <> show title <> " ' not found in " <> show titles
3660
+ [] -> liftIO . assertFailure $ " CodeAction with title " <> show title <> " not found in " <> show titles
3663
3661
a: _ -> pure a
3664
3662
where
3665
3663
titles =
@@ -3686,18 +3684,18 @@ assertNoActionWithTitle title actions =
3686
3684
assertActionWithTitle :: [Command |? CodeAction ] -> T. Text -> Session ()
3687
3685
assertActionWithTitle actions title =
3688
3686
liftIO $ assertBool
3689
- (" CodeAction with title ' " <> show title <> " ' not found in " <> show titles)
3687
+ (" CodeAction with title " <> show title <> " not found in " <> show titles)
3690
3688
(title `elem` titles)
3691
3689
where
3692
3690
titles =
3693
3691
[ actionTitle
3694
3692
| InR CodeAction { _title = actionTitle } <- actions
3695
3693
]
3696
3694
3697
- testSession :: String -> Session () -> TestTree
3695
+ testSession :: TestName -> Session () -> TestTree
3698
3696
testSession name = testCase name . run
3699
3697
3700
- testSessionWithExtraFiles :: HasCallStack => FilePath -> String -> (FilePath -> Session () ) -> TestTree
3698
+ testSessionWithExtraFiles :: HasCallStack => FilePath -> TestName -> (FilePath -> Session () ) -> TestTree
3701
3699
testSessionWithExtraFiles prefix name = testCase name . runWithExtraFiles prefix
3702
3700
3703
3701
runWithExtraFiles :: HasCallStack => FilePath -> (FilePath -> Session a ) -> IO a
@@ -3745,8 +3743,3 @@ assertJust :: MonadIO m => String -> Maybe a -> m a
3745
3743
assertJust s = \ case
3746
3744
Nothing -> liftIO $ assertFailure s
3747
3745
Just x -> pure x
3748
-
3749
- -- | Before ghc9, lists of Char is displayed as [Char], but with ghc9 and up, it's displayed as String
3750
- listOfChar :: T. Text
3751
- listOfChar | ghcVersion >= GHC90 = " String"
3752
- | otherwise = " [Char]"
0 commit comments