diff --git a/submodules/ghc-mod b/submodules/ghc-mod index b247532b8..66fc0980d 160000 --- a/submodules/ghc-mod +++ b/submodules/ghc-mod @@ -1 +1 @@ -Subproject commit b247532b8c7ec22607f7b5c568c41d8181497434 +Subproject commit 66fc0980d2c731caf36215969a31bff8ef40f3e2 diff --git a/test/Functional.hs b/test/Functional.hs index a178ba4a1..b3797bbfa 100644 --- a/test/Functional.hs +++ b/test/Functional.hs @@ -146,6 +146,8 @@ spec = do ) Nothing + -- ----------------------------------- + describe "multi-server setup" $ it "doesn't have clashing commands on two servers" $ do let getCommands = runSession hieCommand "test/testdata" $ do @@ -156,6 +158,8 @@ spec = do List uuids2 <- getCommands liftIO $ forM_ (zip uuids1 uuids2) (uncurry shouldNotBe) + -- ----------------------------------- + describe "code actions" $ it "provide hlint suggestions" $ runSession hieCommand "test/testdata" $ do doc <- openDoc "ApplyRefact2.hs" "haskell" @@ -180,4 +184,24 @@ spec = do liftIO $ do length cmds `shouldBe` 1 evaluateCmd ^. title `shouldBe` "Apply hint:Evaluate" - \ No newline at end of file + + -- ----------------------------------- + + describe "multiple main modules" $ + it "Can load one file at a time, when more than one Main module exists" + -- $ runSession hieCommand "test/testdata" $ do + $ runSession hieCommandVomit "test/testdata" $ do + _doc <- openDoc "ApplyRefact2.hs" "haskell" + _diagsRspHlint <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification + diagsRspGhc <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification + let (List diags) = diagsRspGhc ^. params . diagnostics + + liftIO $ length diags `shouldBe` 2 + + _doc2 <- openDoc "HaReRename.hs" "haskell" + _diagsRspHlint2 <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification + -- errMsg <- skipManyTill anyNotification notification :: Session ShowMessageNotification + diagsRsp2 <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification + let (List diags2) = diagsRsp2 ^. params . diagnostics + + liftIO $ show diags2 `shouldBe` "[]" diff --git a/test/TestUtils.hs b/test/TestUtils.hs index fe315c58f..baa351d9d 100644 --- a/test/TestUtils.hs +++ b/test/TestUtils.hs @@ -10,6 +10,7 @@ module TestUtils , makeRequest , runIGM , hieCommand + , hieCommandVomit ) where import Control.Exception @@ -120,6 +121,9 @@ stackYaml = hieCommand :: String hieCommand = "stack exec --stack-yaml=" ++ stackYaml ++ " hie -- --lsp -d -l test-logs/functional-hie.log" +hieCommandVomit :: String +hieCommandVomit = hieCommand ++ " --vomit" + -- |Choose a resolver based on the current compiler, otherwise HaRe/ghc-mod will -- not be able to load the files readResolver :: IO String diff --git a/test/testdata/ApplyRefact2.hs b/test/testdata/ApplyRefact2.hs index d97afdc88..d83992f38 100644 --- a/test/testdata/ApplyRefact2.hs +++ b/test/testdata/ApplyRefact2.hs @@ -1,2 +1,2 @@ main = undefined -foo x = id x \ No newline at end of file +foo x = id x