Skip to content

Commit 8393b40

Browse files
committed
Add HLS_TEST_EXE env var to control which exe to test
1 parent 404c88c commit 8393b40

20 files changed

+123
-121
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@ jobs:
5454
- name: Build
5555
run: cabal build
5656
- name: Test
57+
env:
58+
HLS_TEST_EXE: hls
5759
run: cabal test
5860

test/functional/Command.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Test.Tasty.ExpectedFailure (ignoreTestBecause)
1818
tests :: TestTree
1919
tests = testGroup "commands" [
2020
testCase "are prefixed" $
21-
runSession hieCommand fullCaps "test/testdata/" $ do
21+
runSession hlsCommand fullCaps "test/testdata/" $ do
2222
ResponseMessage _ _ (Right res) <- initializeResponse
2323
let List cmds = res ^. LSP.capabilities . executeCommandProvider . _Just . commands
2424
f x = (T.length (T.takeWhile isNumber x) >= 1) && (T.count ":" x >= 2)
@@ -27,7 +27,7 @@ tests = testGroup "commands" [
2727
not (null cmds) @? "Commands aren't empty"
2828
, ignoreTestBecause "Broken: Plugin package doesn't exist" $
2929
testCase "get de-prefixed" $
30-
runSession hieCommand fullCaps "test/testdata/" $ do
30+
runSession hlsCommand fullCaps "test/testdata/" $ do
3131
ResponseMessage _ _ (Left err) <- request
3232
WorkspaceExecuteCommand
3333
(ExecuteCommandParams "1234:package:add" (Just (List [])) Nothing) :: Session ExecuteCommandResponse

test/functional/Completion.hs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Test.Tasty.HUnit
1818

1919
tests :: TestTree
2020
tests = testGroup "completions" [
21-
-- testCase "works" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
21+
-- testCase "works" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
2222
-- doc <- openDoc "Completion.hs" "haskell"
2323
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
2424

@@ -40,7 +40,7 @@ tests = testGroup "completions" [
4040
-- resolved ^. insertTextFormat @?= Just Snippet
4141
-- resolved ^. insertText @?= Just "putStrLn ${1:String}"
4242

43-
-- , testCase "completes imports" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
43+
-- , testCase "completes imports" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
4444
-- doc <- openDoc "Completion.hs" "haskell"
4545
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
4646

@@ -54,7 +54,7 @@ tests = testGroup "completions" [
5454
-- item ^. detail @?= Just "Data.Maybe"
5555
-- item ^. kind @?= Just CiModule
5656

57-
-- , testCase "completes qualified imports" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
57+
-- , testCase "completes qualified imports" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
5858
-- doc <- openDoc "Completion.hs" "haskell"
5959
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
6060

@@ -68,7 +68,7 @@ tests = testGroup "completions" [
6868
-- item ^. detail @?= Just "Data.List"
6969
-- item ^. kind @?= Just CiModule
7070

71-
-- , testCase "completes language extensions" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
71+
-- , testCase "completes language extensions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
7272
-- doc <- openDoc "Completion.hs" "haskell"
7373
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
7474

@@ -81,7 +81,7 @@ tests = testGroup "completions" [
8181
-- item ^. label @?= "OverloadedStrings"
8282
-- item ^. kind @?= Just CiKeyword
8383

84-
-- , testCase "completes pragmas" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
84+
-- , testCase "completes pragmas" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
8585
-- doc <- openDoc "Completion.hs" "haskell"
8686
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
8787

@@ -96,7 +96,7 @@ tests = testGroup "completions" [
9696
-- item ^. insertTextFormat @?= Just Snippet
9797
-- item ^. insertText @?= Just "LANGUAGE ${1:extension} #-}"
9898

99-
-- , testCase "completes pragmas no close" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
99+
-- , testCase "completes pragmas no close" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
100100
-- doc <- openDoc "Completion.hs" "haskell"
101101
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
102102

@@ -111,7 +111,7 @@ tests = testGroup "completions" [
111111
-- item ^. insertTextFormat @?= Just Snippet
112112
-- item ^. insertText @?= Just "LANGUAGE ${1:extension}"
113113

114-
-- , testCase "completes options pragma" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
114+
-- , testCase "completes options pragma" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
115115
-- doc <- openDoc "Completion.hs" "haskell"
116116
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
117117

@@ -128,7 +128,7 @@ tests = testGroup "completions" [
128128

129129
-- -- -----------------------------------
130130

131-
-- , testCase "completes ghc options pragma values" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
131+
-- , testCase "completes ghc options pragma values" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
132132
-- doc <- openDoc "Completion.hs" "haskell"
133133

134134
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
@@ -146,14 +146,14 @@ tests = testGroup "completions" [
146146

147147
-- -- -----------------------------------
148148

149-
-- , testCase "completes with no prefix" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
149+
-- , testCase "completes with no prefix" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
150150
-- doc <- openDoc "Completion.hs" "haskell"
151151
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
152152
-- compls <- getCompletions doc (Position 5 7)
153153
-- liftIO $ filter ((== "!!") . (^. label)) compls `shouldNotSatisfy` null
154154

155155
-- -- See https://github.com/haskell/haskell-ide-engine/issues/903
156-
-- , testCase "strips compiler generated stuff from completions" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
156+
-- , testCase "strips compiler generated stuff from completions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
157157
-- doc <- openDoc "DupRecFields.hs" "haskell"
158158
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
159159

@@ -168,7 +168,7 @@ tests = testGroup "completions" [
168168
-- item ^. detail @?= Just "Two -> Int\nDupRecFields"
169169
-- item ^. insertText @?= Just "accessor ${1:Two}"
170170

171-
-- , testCase "have implicit foralls on basic polymorphic types" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
171+
-- , testCase "have implicit foralls on basic polymorphic types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
172172
-- doc <- openDoc "Completion.hs" "haskell"
173173
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
174174
-- let te = TextEdit (Range (Position 5 7) (Position 5 9)) "id"
@@ -180,7 +180,7 @@ tests = testGroup "completions" [
180180
-- liftIO $
181181
-- resolved ^. detail @?= Just "a -> a\nPrelude"
182182

183-
-- , testCase "have implicit foralls with multiple type variables" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
183+
-- , testCase "have implicit foralls with multiple type variables" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
184184
-- doc <- openDoc "Completion.hs" "haskell"
185185
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
186186
-- let te = TextEdit (Range (Position 5 7) (Position 5 24)) "flip"
@@ -198,7 +198,7 @@ tests = testGroup "completions" [
198198

199199
-- snippetTests :: TestTree
200200
-- snippetTests = testGroup "snippets" [
201-
-- testCase "work for argumentless constructors" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
201+
-- testCase "work for argumentless constructors" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
202202
-- doc <- openDoc "Completion.hs" "haskell"
203203
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
204204

@@ -211,7 +211,7 @@ tests = testGroup "completions" [
211211
-- item ^. insertTextFormat @?= Just Snippet
212212
-- item ^. insertText @?= Just "Nothing"
213213

214-
-- , testCase "work for polymorphic types" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
214+
-- , testCase "work for polymorphic types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
215215
-- doc <- openDoc "Completion.hs" "haskell"
216216
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
217217

@@ -228,7 +228,7 @@ tests = testGroup "completions" [
228228
-- resolved ^. insertTextFormat @?= Just Snippet
229229
-- resolved ^. insertText @?= Just "foldl ${1:b -> a -> b} ${2:b} ${3:t a}"
230230

231-
-- , testCase "work for complex types" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
231+
-- , testCase "work for complex types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
232232
-- doc <- openDoc "Completion.hs" "haskell"
233233
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
234234

@@ -245,7 +245,7 @@ tests = testGroup "completions" [
245245
-- resolved ^. insertTextFormat @?= Just Snippet
246246
-- resolved ^. insertText @?= Just "mapM ${1:a -> m b} ${2:t a}"
247247

248-
-- , testCase "work for infix functions" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
248+
-- , testCase "work for infix functions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
249249
-- doc <- openDoc "Completion.hs" "haskell"
250250
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
251251

@@ -260,7 +260,7 @@ tests = testGroup "completions" [
260260
-- item ^. insertTextFormat @?= Just Snippet
261261
-- item ^. insertText @?= Just "filter`"
262262

263-
-- , testCase "work for infix functions in backticks" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
263+
-- , testCase "work for infix functions in backticks" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
264264
-- doc <- openDoc "Completion.hs" "haskell"
265265
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
266266

@@ -275,7 +275,7 @@ tests = testGroup "completions" [
275275
-- item ^. insertTextFormat @?= Just Snippet
276276
-- item ^. insertText @?= Just "filter"
277277

278-
-- , testCase "work for qualified infix functions" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
278+
-- , testCase "work for qualified infix functions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
279279
-- doc <- openDoc "Completion.hs" "haskell"
280280
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
281281

@@ -290,7 +290,7 @@ tests = testGroup "completions" [
290290
-- item ^. insertTextFormat @?= Just Snippet
291291
-- item ^. insertText @?= Just "intersperse`"
292292

293-
-- , testCase "work for qualified infix functions in backticks" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
293+
-- , testCase "work for qualified infix functions in backticks" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
294294
-- doc <- openDoc "Completion.hs" "haskell"
295295
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
296296

@@ -306,7 +306,7 @@ tests = testGroup "completions" [
306306
-- item ^. insertText @?= Just "intersperse"
307307

308308
-- -- TODO : Fix compile issue in the test "Variable not in scope: object"
309-
-- , testCase "respects lsp configuration" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
309+
-- , testCase "respects lsp configuration" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
310310
-- doc <- openDoc "Completion.hs" "haskell"
311311
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
312312

@@ -317,7 +317,7 @@ tests = testGroup "completions" [
317317

318318
-- checkNoSnippets doc
319319

320-
-- , testCase "respects client capabilities" $ runSession hieCommand noSnippetsCaps "test/testdata/completion" $ do
320+
-- , testCase "respects client capabilities" $ runSession hlsCommand noSnippetsCaps "test/testdata/completion" $ do
321321
-- doc <- openDoc "Completion.hs" "haskell"
322322
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
323323

@@ -359,7 +359,7 @@ tests = testGroup "completions" [
359359
contextTests :: TestTree
360360
contextTests = testGroup "contexts" [
361361
ignoreTestBecause "Broken: Timed out waiting to receive a message from the server" $
362-
testCase "only provides type suggestions" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
362+
testCase "only provides type suggestions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
363363
doc <- openDoc "Context.hs" "haskell"
364364
_ <- count 2 $ skipManyTill loggingNotification noDiagnostics
365365
compls <- getCompletions doc (Position 2 17)
@@ -368,7 +368,7 @@ contextTests = testGroup "contexts" [
368368
compls `shouldNotContainCompl` "interact"
369369

370370
, ignoreTestBecause "Broken: Timed out waiting to receive a message from the server" $
371-
testCase "only provides type suggestions" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
371+
testCase "only provides type suggestions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
372372
doc <- openDoc "Context.hs" "haskell"
373373
_ <- count 2 $ skipManyTill loggingNotification noDiagnostics
374374
compls <- getCompletions doc (Position 3 9)
@@ -377,7 +377,7 @@ contextTests = testGroup "contexts" [
377377
compls `shouldNotContainCompl` "Applicative"
378378

379379
-- This currently fails if , testCase takes too long to typecheck the module
380-
-- , testCase "completes qualified type suggestions" $ runSession hieCommand fullCaps "test/testdata/completion" $ do
380+
-- , testCase "completes qualified type suggestions" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
381381
-- doc <- openDoc "Context.hs" "haskell"
382382
-- _ <- count 2 $ skipManyTill loggingNotification noDiagnostics
383383
-- let te = TextEdit (Range (Position 2 17) (Position 2 17)) " -> Conc."

test/functional/Deferred.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tests :: TestTree
2222
tests = testGroup "deferred responses" [
2323

2424
--TODO: DOes not compile
25-
-- testCase "do not affect hover requests" $ runSession hieCommand fullCaps "test/testdata" $ do
25+
-- testCase "do not affect hover requests" $ runSession hlsCommand fullCaps "test/testdata" $ do
2626
-- doc <- openDoc "FuncTest.hs" "haskell"
2727

2828
-- id1 <- sendRequest TextDocumentHover (TextDocumentPositionParams doc (Position 4 2) Nothing)
@@ -91,21 +91,21 @@ tests = testGroup "deferred responses" [
9191
-- }
9292
-- ]
9393

94-
testCase "instantly respond to failed modules with no cache" $ runSession hieCommand fullCaps "test/testdata" $ do
94+
testCase "instantly respond to failed modules with no cache" $ runSession hlsCommand fullCaps "test/testdata" $ do
9595
doc <- openDoc "FuncTestFail.hs" "haskell"
9696
defs <- getDefinitions doc (Position 1 11)
9797
liftIO $ defs @?= []
9898

9999
-- TODO: the benefits of caching parsed modules is doubted.
100100
-- TODO: add issue link
101101
-- , testCase "respond to untypecheckable modules with parsed module cache" $
102-
-- runSession hieCommand fullCaps "test/testdata" $ do
102+
-- runSession hlsCommand fullCaps "test/testdata" $ do
103103
-- doc <- openDoc "FuncTestFail.hs" "haskell"
104104
-- (Left (sym:_)) <- getDocumentSymbols doc
105105
-- liftIO $ sym ^. name @?= "main"
106106

107107
-- TODO does not compile
108-
-- , testCase "returns hints as diagnostics" $ runSession hieCommand fullCaps "test/testdata" $ do
108+
-- , testCase "returns hints as diagnostics" $ runSession hlsCommand fullCaps "test/testdata" $ do
109109
-- _ <- openDoc "FuncTest.hs" "haskell"
110110

111111
-- cwd <- liftIO getCurrentDirectory
@@ -145,7 +145,7 @@ tests = testGroup "deferred responses" [
145145
-- multiServerTests :: TestTree
146146
-- multiServerTests = testGroup "multi-server setup" [
147147
-- testCase "doesn't have clashing commands on two servers" $ do
148-
-- let getCommands = runSession hieCommand fullCaps "test/testdata" $ do
148+
-- let getCommands = runSession hlsCommand fullCaps "test/testdata" $ do
149149
-- rsp <- initializeResponse
150150
-- let uuids = rsp ^? result . _Just . capabilities . executeCommandProvider . _Just . commands
151151
-- return $ fromJust uuids
@@ -158,7 +158,7 @@ multiMainTests :: TestTree
158158
multiMainTests = testGroup "multiple main modules" [
159159
ignoreTestBecause "Broken: Unexpected ConduitParser.empty" $
160160
testCase "Can load one file at a time, when more than one Main module exists"
161-
$ runSession hieCommand fullCaps "test/testdata" $ do
161+
$ runSession hlsCommand fullCaps "test/testdata" $ do
162162
_doc <- openDoc "ApplyRefact2.hs" "haskell"
163163
_diagsRspHlint <- skipManyTill anyNotification message :: Session PublishDiagnosticsNotification
164164
diagsRspGhc <- skipManyTill anyNotification message :: Session PublishDiagnosticsNotification

test/functional/Definition.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tests :: TestTree
1515
tests = testGroup "definitions" [
1616

1717
ignoreTestBecause "Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/References.hs" $
18-
testCase "goto's symbols" $ runSession hieCommand fullCaps "test/testdata" $ do
18+
testCase "goto's symbols" $ runSession hlsCommand fullCaps "test/testdata" $ do
1919
doc <- openDoc "References.hs" "haskell"
2020
defs <- getDefinitions doc (Position 7 8)
2121
let expRange = Range (Position 4 0) (Position 4 3)
@@ -24,23 +24,23 @@ tests = testGroup "definitions" [
2424
-- -----------------------------------
2525

2626
, ignoreTestBecause "Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs" $
27-
testCase "goto's imported modules" $ runSession hieCommand fullCaps "test/testdata/definition" $ do
27+
testCase "goto's imported modules" $ runSession hlsCommand fullCaps "test/testdata/definition" $ do
2828
doc <- openDoc "Foo.hs" "haskell"
2929
defs <- getDefinitions doc (Position 2 8)
3030
liftIO $ do
3131
fp <- canonicalizePath "test/testdata/definition/Bar.hs"
3232
defs @?= [Location (filePathToUri fp) zeroRange]
3333

3434
, ignoreTestBecause "Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs" $
35-
testCase "goto's exported modules" $ runSession hieCommand fullCaps "test/testdata/definition" $ do
35+
testCase "goto's exported modules" $ runSession hlsCommand fullCaps "test/testdata/definition" $ do
3636
doc <- openDoc "Foo.hs" "haskell"
3737
defs <- getDefinitions doc (Position 0 15)
3838
liftIO $ do
3939
fp <- canonicalizePath "test/testdata/definition/Bar.hs"
4040
defs @?= [Location (filePathToUri fp) zeroRange]
4141

4242
, ignoreTestBecause "Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs" $
43-
testCase "goto's imported modules that are loaded" $ runSession hieCommand fullCaps "test/testdata/definition" $ do
43+
testCase "goto's imported modules that are loaded" $ runSession hlsCommand fullCaps "test/testdata/definition" $ do
4444
doc <- openDoc "Foo.hs" "haskell"
4545
_ <- openDoc "Bar.hs" "haskell"
4646
defs <- getDefinitions doc (Position 2 8)
@@ -50,7 +50,7 @@ tests = testGroup "definitions" [
5050

5151
, ignoreTestBecause "Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs" $
5252
testCase "goto's imported modules that are loaded, and then closed" $
53-
runSession hieCommand fullCaps "test/testdata/definition" $ do
53+
runSession hlsCommand fullCaps "test/testdata/definition" $ do
5454
doc <- openDoc "Foo.hs" "haskell"
5555
otherDoc <- openDoc "Bar.hs" "haskell"
5656
closeDoc otherDoc

0 commit comments

Comments
 (0)