Skip to content

Commit a43af6a

Browse files
committed
post-merge fixes
1 parent 03d3644 commit a43af6a

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Diff for: ghcide/test/exe/Main.hs

+3-4
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@ import Development.IDE.Test (Cursor,
5050
expectNoMoreDiagnostics,
5151
flushMessages,
5252
standardizeQuotes,
53-
getInterfaceFilesDir
53+
getInterfaceFilesDir,
5454
waitForAction,
5555
getStoredKeys,
56-
waitForTypecheck,
57-
getFilesOfInterest, waitForGC)
56+
waitForTypecheck, waitForGC)
5857
import Development.IDE.Test.Runfiles
5958
import qualified Development.IDE.Types.Diagnostics as Diagnostics
6059
import Development.IDE.Types.Location
@@ -5254,7 +5253,7 @@ ifaceErrorTest = testCase "iface-error-test-1" $ runWithExtraFiles "recomp" $ \d
52545253

52555254

52565255
-- Check that we wrote the interfaces for B when we saved
5257-
Right hidir <- getInterfaceFilesDir bdoc
5256+
hidir <- getInterfaceFilesDir bdoc
52585257
hi_exists <- liftIO $ doesFileExist $ hidir </> "B.hi"
52595258
liftIO $ assertBool ("Couldn't find B.hi in " ++ hidir) hi_exists
52605259

Diff for: ghcide/test/src/Development/IDE/Test.hs

+9-9
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,25 @@ canonicalizeUri uri = filePathToUri <$> canonicalizePath (fromJust (uriToFilePat
182182
diagnostic :: Session (NotificationMessage TextDocumentPublishDiagnostics)
183183
diagnostic = LspTest.message STextDocumentPublishDiagnostics
184184

185-
callTestPlugin :: (A.FromJSON b) => TestRequest -> Session (Either ResponseError b)
185+
callTestPlugin :: (A.FromJSON b) => TestRequest -> Session b
186186
callTestPlugin cmd = do
187187
let cm = SCustomMethod "test"
188188
waitId <- sendRequest cm (A.toJSON cmd)
189189
ResponseMessage{_result} <- skipManyTill anyMessage $ responseForId cm waitId
190-
return $ do
191-
e <- _result
192-
case A.fromJSON e of
193-
A.Error e -> Left $ ResponseError InternalError (T.pack e) Nothing
194-
A.Success a -> pure a
190+
return $ case _result of
191+
Left (ResponseError t err _) -> error $ show t <> ": " <> T.unpack err
192+
Right json -> case A.fromJSON json of
193+
A.Success a -> a
194+
A.Error e -> error e
195195

196-
waitForAction :: String -> TextDocumentIdentifier -> Session (Either ResponseError WaitForIdeRuleResult)
196+
waitForAction :: String -> TextDocumentIdentifier -> Session WaitForIdeRuleResult
197197
waitForAction key TextDocumentIdentifier{_uri} =
198198
callTestPlugin (WaitForIdeRule key _uri)
199199

200-
getLastBuildKeys :: Session (Either ResponseError [T.Text])
200+
getLastBuildKeys :: Session [T.Text]
201201
getLastBuildKeys = callTestPlugin GetLastBuildKeys
202202

203-
getInterfaceFilesDir :: TextDocumentIdentifier -> Session (Either ResponseError FilePath)
203+
getInterfaceFilesDir :: TextDocumentIdentifier -> Session FilePath
204204
getInterfaceFilesDir TextDocumentIdentifier{_uri} = callTestPlugin (GetInterfaceFilesDir _uri)
205205

206206
garbageCollectDirtyKeys :: CheckParents -> Int -> Session [String]

0 commit comments

Comments
 (0)