File: API.hs

package info (click to toggle)
haskell-tls 2.1.8-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,056 kB
  • sloc: haskell: 15,695; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 549 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE OverloadedStrings #-}

module API where

import Control.Applicative
import Control.Monad
import Data.ByteString (ByteString)
import Data.Maybe
import Network.TLS
import Test.Hspec

checkCtxFinished :: Context -> IO ()
checkCtxFinished ctx = do
    mUnique <- getTLSUnique ctx
    mExporter <- getTLSExporter ctx
    when (isNothing (mUnique <|> mExporter)) $
        fail "unexpected channel binding"

recvDataAssert :: Context -> ByteString -> IO ()
recvDataAssert ctx expected = do
    got <- recvData ctx
    got `shouldBe` expected