4
4
-- | The matrix client specification tests
5
5
module Main (main ) where
6
6
7
+ import Control.Monad.Except
7
8
import qualified Data.Aeson.Encode.Pretty as Aeson
8
9
import qualified Data.ByteString.Lazy as BS
9
10
import Data.Either (isLeft )
@@ -12,8 +13,8 @@ import Data.Time.Clock.System (SystemTime (..), getSystemTime)
12
13
import Network.Matrix.Client
13
14
import Network.Matrix.Internal
14
15
import System.Environment (lookupEnv )
16
+ import Test.DocTest (doctest )
15
17
import Test.Hspec
16
- import Control.Monad.Except
17
18
18
19
main :: IO ()
19
20
main = do
@@ -26,7 +27,13 @@ main = do
26
27
_ -> do
27
28
putStrLn " Skipping integration test"
28
29
pure $ pure mempty
29
- hspec (parallel $ spec >> runIntegration)
30
+ hspec (parallel $ spec >> runIntegration >> docTest)
31
+
32
+ docTest :: Spec
33
+ docTest = do
34
+ describe " doctest" $ do
35
+ it " works" $ do
36
+ doctest [" -XOverloadedStrings" , " src/" ]
30
37
31
38
integration :: ClientSession -> ClientSession -> Spec
32
39
integration sess1 sess2 = do
@@ -44,7 +51,7 @@ integration sess1 sess2 = do
44
51
case resp of
45
52
Left err -> meError err `shouldBe` " Alias already exists"
46
53
Right (RoomID roomID') -> roomID' `shouldSatisfy` (/= mempty )
47
- it " join room" $ do
54
+ it " join room" $ do
48
55
resp <- runMatrixM sess1 $ joinRoom " #test:localhost"
49
56
case resp of
50
57
Left err -> error (show err)
@@ -57,7 +64,7 @@ integration sess1 sess2 = do
57
64
result <- runMatrixM sess2 $ do
58
65
-- Flush previous events
59
66
sr <- sync Nothing Nothing Nothing Nothing
60
- [room] <- getJoinedRooms
67
+ [room] <- getJoinedRooms
61
68
let msg body = RoomMessageText $ MessageText body TextType Nothing Nothing
62
69
let since = srNextBatch sr
63
70
eventID <- sendMessage room (EventRoomMessage $ msg " Hello" ) (TxnID since)
0 commit comments