File: TypedSpec.hs

package info (click to toggle)
haskell-conduit-extra 1.3.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 288 kB
  • sloc: haskell: 2,601; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 746 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
23
24
module Data.Conduit.Process.TypedSpec (spec) where

import Test.Hspec
import Data.Conduit
import Data.Conduit.Process.Typed
import qualified Data.Conduit.List as CL
import qualified Data.ByteString as B

spec :: Spec
spec = do
  it "cat works" $ do
    let fp = "ChangeLog.md"
        pc = setStdout createSource $ proc "cat" [fp]
    bs <- B.readFile fp
    bss <- withProcess_ pc $ \p ->
      runConduit (getStdout p .| CL.consume) <* waitExitCode p
    B.concat bss `shouldBe` bs
  it "cat works with withLoggedProcess_" $ do
    let fp = "ChangeLog.md"
        pc = proc "cat" [fp]
    bs <- B.readFile fp
    bss <- withLoggedProcess_ pc $ \p ->
      runConduit (getStdout p .| CL.consume) <* waitExitCode p
    B.concat bss `shouldBe` bs