1234567891011121314151617181920212223242526 |
- {-# LANGUAGE OverloadedStrings #-}
- module TestConduit (tests) where
- import Distribution.TestSuite
- import Base
- import qualified Data.Conduit.List as C
- import System.IO.Uniform.ByteString
- import System.IO.Uniform.Conduit
- import Data.Monoid (Sum(..))
- import qualified Data.ByteString as BS
- tests :: IO [Test]
- tests = do
- return [
- simpleTest "runConduit" testRunConduit
- ]
- testRunConduit :: IO Progress
- testRunConduit = do
- let dt = "Some data to test ByteString"
- (Sum len, _) <- withByteStringIO dt $ \io ->
- runConduit io (C.foldMap (Sum . BS.length))
- if BS.length dt /= len
- then return . Finished . Fail $ "Failure on ByteStringIO test. Length is: " ++ show len
- else return . Finished $ Pass
|