Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 8851688

Browse files
authored
Merge pull request #645 from alanz/multi-main
Multi main
2 parents 374da07 + 9e3372b commit 8851688

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

test/Functional.hs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ spec = do
146146
)
147147
Nothing
148148

149+
-- -----------------------------------
150+
149151
describe "multi-server setup" $
150152
it "doesn't have clashing commands on two servers" $ do
151153
let getCommands = runSession hieCommand "test/testdata" $ do
@@ -156,6 +158,8 @@ spec = do
156158
List uuids2 <- getCommands
157159
liftIO $ forM_ (zip uuids1 uuids2) (uncurry shouldNotBe)
158160

161+
-- -----------------------------------
162+
159163
describe "code actions" $
160164
it "provide hlint suggestions" $ runSession hieCommand "test/testdata" $ do
161165
doc <- openDoc "ApplyRefact2.hs" "haskell"
@@ -180,4 +184,24 @@ spec = do
180184
liftIO $ do
181185
length cmds `shouldBe` 1
182186
evaluateCmd ^. title `shouldBe` "Apply hint:Evaluate"
183-
187+
188+
-- -----------------------------------
189+
190+
describe "multiple main modules" $
191+
it "Can load one file at a time, when more than one Main module exists"
192+
-- $ runSession hieCommand "test/testdata" $ do
193+
$ runSession hieCommandVomit "test/testdata" $ do
194+
_doc <- openDoc "ApplyRefact2.hs" "haskell"
195+
_diagsRspHlint <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification
196+
diagsRspGhc <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification
197+
let (List diags) = diagsRspGhc ^. params . diagnostics
198+
199+
liftIO $ length diags `shouldBe` 2
200+
201+
_doc2 <- openDoc "HaReRename.hs" "haskell"
202+
_diagsRspHlint2 <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification
203+
-- errMsg <- skipManyTill anyNotification notification :: Session ShowMessageNotification
204+
diagsRsp2 <- skipManyTill anyNotification notification :: Session PublishDiagnosticsNotification
205+
let (List diags2) = diagsRsp2 ^. params . diagnostics
206+
207+
liftIO $ show diags2 `shouldBe` "[]"

test/TestUtils.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module TestUtils
1010
, makeRequest
1111
, runIGM
1212
, hieCommand
13+
, hieCommandVomit
1314
) where
1415

1516
import Control.Exception
@@ -120,6 +121,9 @@ stackYaml =
120121
hieCommand :: String
121122
hieCommand = "stack exec --stack-yaml=" ++ stackYaml ++ " hie -- --lsp -d -l test-logs/functional-hie.log"
122123

124+
hieCommandVomit :: String
125+
hieCommandVomit = hieCommand ++ " --vomit"
126+
123127
-- |Choose a resolver based on the current compiler, otherwise HaRe/ghc-mod will
124128
-- not be able to load the files
125129
readResolver :: IO String

test/testdata/ApplyRefact2.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
main = undefined
2-
foo x = id x
2+
foo x = id x

0 commit comments

Comments
 (0)