@@ -9,23 +9,31 @@ main = defaultTestRunner $ testGroup "haskell-language-server-wrapper" [projectG
99
1010projectGhcVersionTests :: TestTree
1111projectGhcVersionTests = 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
1323 , testCase " cabal with global ghc" $ do
1424 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
1626 , testCase " stack with existing cabal build artifact" $ do
1727 -- Should report cabal as existing build artifacts are more important than
1828 -- the existence of 'stack.yaml'
1929 testProjectType " test/wrapper/testdata/stack-with-dist-newstyle"
2030 (" cradleOptsProg = CradleAction: Cabal" `isInfixOf` )
2131 ]
22- where
23- stackTest ghcVer= testCase (" stack with ghc " ++ ghcVer) $
24- testDir (" test/wrapper/testdata/stack-" ++ ghcVer) ghcVer
2532
26- testDir :: FilePath -> String -> Assertion
27- testDir dir expectedVer =
33+ testDir :: IO () -> FilePath -> String -> Assertion
34+ testDir extraSetup dir expectedVer =
2835 withCurrentDirectoryInTmp dir $ do
36+ extraSetup
2937 testExe <- fromMaybe " haskell-language-server-wrapper"
3038 <$> lookupEnv " HLS_WRAPPER_TEST_EXE"
3139 actualVer <- trimEnd <$> readProcess testExe [" --project-ghc-version" ] " "
0 commit comments