Skip to content

Commit 5d328e3

Browse files
fendorsoulomoon
authored andcommitted
Run ExceptionTests in temporary directory (haskell#4146)
1 parent 8394f60 commit 5d328e3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

ghcide/test/exe/ExceptionTests.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ tests recorder logger = do
5555
(view L.result -> lens) <- request SMethod_TextDocumentCodeLens (CodeLensParams Nothing Nothing doc)
5656
case lens of
5757
Left (ResponseError {_code = InR ErrorCodes_InternalError, _message}) ->
58-
liftIO $ assertBool "We caught an error, but it wasn't ours!"
58+
liftIO $ assertBool "We caught an error, but it wasn't ours!"
5959
(T.isInfixOf "divide by zero" _message && T.isInfixOf (coerce pluginId) _message)
6060
_ -> liftIO $ assertFailure $ show lens
6161

ghcide/test/exe/TestUtils.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,12 @@ testIde recorder arguments session = do
307307
cwd <- getCurrentDirectory
308308
(hInRead, hInWrite) <- createPipe
309309
(hOutRead, hOutWrite) <- createPipe
310-
let projDir = "."
310+
311311
let server = IDE.defaultMain (cmapWithPrio LogIDEMain recorder) arguments
312312
{ IDE.argsHandleIn = pure hInRead
313313
, IDE.argsHandleOut = pure hOutWrite
314314
}
315315

316-
flip finally (setCurrentDirectory cwd) $ withAsync server $ \_ ->
317-
runSessionWithHandles hInWrite hOutRead config lspTestCaps projDir session
316+
withTempDir $ \dir -> do
317+
flip finally (setCurrentDirectory cwd) $ withAsync server $ \_ ->
318+
runSessionWithHandles hInWrite hOutRead config lspTestCaps dir session

hls-test-utils/src/Test/Hls.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ setupTestEnvironment = do
470470
createDirectoryIfMissing True testCacheDir
471471
setEnv "XDG_CACHE_HOME" testCacheDir
472472
pure testRoot
473+
473474
goldenWithHaskellDocFormatter
474475
:: Pretty b
475476
=> Config

0 commit comments

Comments
 (0)