@@ -1369,7 +1369,8 @@ findDefinitionAndHoverTests = let
1369
1369
1370
1370
mkFindTests tests = testGroup " get"
1371
1371
[ testGroup " definition" $ mapMaybe fst tests
1372
- , testGroup " hover" $ mapMaybe snd tests ]
1372
+ , testGroup " hover" $ mapMaybe snd tests
1373
+ , checkFileCompiles sourceFilePath ]
1373
1374
1374
1375
test runDef runHover look expect = testM runDef runHover look (return expect)
1375
1376
@@ -1464,6 +1465,12 @@ findDefinitionAndHoverTests = let
1464
1465
broken = Just . (`xfail` " known broken" )
1465
1466
no = const Nothing -- don't run this test at all
1466
1467
1468
+ checkFileCompiles :: FilePath -> TestTree
1469
+ checkFileCompiles fp =
1470
+ testSessionWait (" Does " ++ fp ++ " compile" ) $
1471
+ void (openTestDataDoc fp)
1472
+
1473
+
1467
1474
pluginTests :: TestTree
1468
1475
pluginTests = (`xfail8101` " known broken (#556)" )
1469
1476
$ testSessionWait " plugins" $ do
@@ -2026,8 +2033,8 @@ cradleTests = testGroup "cradle"
2026
2033
2027
2034
loadCradleOnlyonce :: TestTree
2028
2035
loadCradleOnlyonce = testGroup " load cradle only once"
2029
- [ testSession' " implicit" implicit
2030
- , testSession' " direct" direct
2036
+ [ testSessionTF " implicit" implicit
2037
+ , testSessionTF " direct" direct
2031
2038
]
2032
2039
where
2033
2040
direct dir = do
@@ -2136,7 +2143,10 @@ testSession :: String -> Session () -> TestTree
2136
2143
testSession name = testCase name . run
2137
2144
2138
2145
testSession' :: String -> (FilePath -> Session () ) -> TestTree
2139
- testSession' name = testCase name . run'
2146
+ testSession' name = testCase name . run' NoTestFlag
2147
+
2148
+ testSessionTF :: String -> (FilePath -> Session () ) -> TestTree
2149
+ testSessionTF name = testCase name . run' WithTestFlag
2140
2150
2141
2151
testSessionWait :: String -> Session () -> TestTree
2142
2152
testSessionWait name = testSession name .
@@ -2167,13 +2177,16 @@ mkRange :: Int -> Int -> Int -> Int -> Range
2167
2177
mkRange a b c d = Range (Position a b) (Position c d)
2168
2178
2169
2179
run :: Session a -> IO a
2170
- run s = withTempDir $ \ dir -> runInDir dir s
2180
+ run s = withTempDir $ \ dir -> runInDir NoTestFlag dir s
2181
+
2182
+ run' :: WithTestFlag -> (FilePath -> Session a ) -> IO a
2183
+ run' tf s = withTempDir $ \ dir -> runInDir tf dir (s dir)
2171
2184
2172
- run' :: ( FilePath -> Session a ) -> IO a
2173
- run' s = withTempDir $ \ dir -> runInDir dir (s dir )
2185
+ -- Do we run the LSP executable with --test or not
2186
+ data WithTestFlag = WithTestFlag | NoTestFlag deriving ( Show , Eq )
2174
2187
2175
- runInDir :: FilePath -> Session a -> IO a
2176
- runInDir dir s = do
2188
+ runInDir :: WithTestFlag -> FilePath -> Session a -> IO a
2189
+ runInDir withTestFlag dir s = do
2177
2190
ghcideExe <- locateGhcideExecutable
2178
2191
2179
2192
-- Temporarily hack around https://github.com/mpickering/hie-bios/pull/56
@@ -2186,7 +2199,8 @@ runInDir dir s = do
2186
2199
createDirectoryIfMissing True $ dir </> takeDirectory f
2187
2200
copyFile (" test/data" </> f) (dir </> f)
2188
2201
2189
- let cmd = unwords [ghcideExe, " --lsp" , " --test" , " --cwd" , dir]
2202
+ let cmd = unwords ([ghcideExe, " --lsp" , " --cwd" , dir]
2203
+ ++ [ " --test" | WithTestFlag == withTestFlag ])
2190
2204
-- HIE calls getXgdDirectory which assumes that HOME is set.
2191
2205
-- Only sets HOME if it wasn't already set.
2192
2206
setEnv " HOME" " /homeless-shelter" False
0 commit comments