@@ -9,23 +9,31 @@ main = defaultTestRunner $ testGroup "haskell-language-server-wrapper" [projectG
9
9
10
10
projectGhcVersionTests :: TestTree
11
11
projectGhcVersionTests = testGroup " --project-ghc-version"
12
- [ stackTest " 9.2.8"
12
+ [ let ghcVer = case ghcVersion of
13
+ GHC92 -> " 9.2.8"
14
+ GHC94 -> " 9.4.8"
15
+ GHC96 -> " 9.6.4"
16
+ GHC98 -> " 9.8.1"
17
+ writeStackYaml = writeFile " stack.yaml"
18
+ -- Use system-ghc and install-ghc to avoid stack downloading ghc in CI
19
+ -- (and use ghcup-managed ghc instead)
20
+ (" {resolver: ghc-" ++ ghcVer ++ " , system-ghc: true, install-ghc: false}" )
21
+ in testCase (" stack with ghc " ++ ghcVer) $
22
+ testDir writeStackYaml " test/wrapper/testdata/stack-specific-ghc" ghcVer
13
23
, testCase " cabal with global ghc" $ do
14
24
ghcVer <- trimEnd <$> readProcess " ghc" [" --numeric-version" ] " "
15
- testDir " test/wrapper/testdata/cabal-cur-ver" ghcVer
25
+ testDir ( pure () ) " test/wrapper/testdata/cabal-cur-ver" ghcVer
16
26
, testCase " stack with existing cabal build artifact" $ do
17
27
-- Should report cabal as existing build artifacts are more important than
18
28
-- the existence of 'stack.yaml'
19
29
testProjectType " test/wrapper/testdata/stack-with-dist-newstyle"
20
30
(" cradleOptsProg = CradleAction: Cabal" `isInfixOf` )
21
31
]
22
- where
23
- stackTest ghcVer= testCase (" stack with ghc " ++ ghcVer) $
24
- testDir (" test/wrapper/testdata/stack-" ++ ghcVer) ghcVer
25
32
26
- testDir :: FilePath -> String -> Assertion
27
- testDir dir expectedVer =
33
+ testDir :: IO () -> FilePath -> String -> Assertion
34
+ testDir extraSetup dir expectedVer =
28
35
withCurrentDirectoryInTmp dir $ do
36
+ extraSetup
29
37
testExe <- fromMaybe " haskell-language-server-wrapper"
30
38
<$> lookupEnv " HLS_WRAPPER_TEST_EXE"
31
39
actualVer <- trimEnd <$> readProcess testExe [" --project-ghc-version" ] " "
0 commit comments