X-Git-Url: https://git.lukelau.me/?a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FRecorded.hs;h=504f3ff1f74fb68fd810d88fff1061c80abc7353;hb=0c8e8f8436125b79e91a51267ca581d2e352e702;hp=a52c313c4bd6565073f1f2732faf6af2406cb2dc;hpb=37aa4a22ec691b45bbd1cd0dd23d70e90a0c4e40;p=lsp-test.git diff --git a/src/Language/Haskell/LSP/Test/Recorded.hs b/src/Language/Haskell/LSP/Test/Recorded.hs index a52c313..504f3ff 100644 --- a/src/Language/Haskell/LSP/Test/Recorded.hs +++ b/src/Language/Haskell/LSP/Test/Recorded.hs @@ -94,7 +94,6 @@ replay cfp sfp curRootDir = do -- cleanup temp files removeFile mappedClientRecFp - cleanupFiles return result @@ -160,7 +159,7 @@ listenServer expectedMsgs h semas@(reqSema, rspSema) = do lift $ putStrLn $ "Got notification " ++ show (n ^. LSP.method) lift $ print n - lift $ putStrLn $ (show ((length $ filter isNotification expectedMsgs) - 1)) ++ " notifications remaining" + lift $ putStrLn $ show ((length $ filter isNotification expectedMsgs) - 1) ++ " notifications remaining" if n ^. LSP.method == LSP.WindowLogMessage then return expectedMsgs @@ -171,15 +170,15 @@ listenServer expectedMsgs h semas@(reqSema, rspSema) = do _ = expected == msg -- make expected type same as res failSession ("Out of order\nExpected\n" ++ show expected ++ "\nGot\n" ++ show msg ++ "\n") - markReceived msg = do + markReceived msg = let new = deleteFirstJson msg expectedMsgs - in if (new == expectedMsgs) + in if new == expectedMsgs then failSession ("Unexpected message: " ++ show msg) >> return new else return new deleteFirstJson _ [] = [] deleteFirstJson msg (x:xs) - | (Just msg) == (decode x) = xs + | Just msg == decode x = xs | otherwise = x:deleteFirstJson msg xs firstExpected = head $ filter (not . isNotification) expectedMsgs