summaryrefslogtreecommitdiff
path: root/test/main.hs
blob: 997d209664505721cb6db25604f63a7781e74537 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import qualified Data.ByteString.Lazy as B
import qualified Data.Text.IO as TIO
import Data.Conduit.Binary
import Paths_pager
import System.Pager

testPrintOrPage :: FilePath ->  IO ()
testPrintOrPage fnom =
  TIO.readFile fnom >>= printOrPage

testConduit :: FilePath ->  IO ()
testConduit fnom =
  sendToPagerConduit (sourceFile fnom)

test :: FilePath -> IO ()
test fp = B.readFile fp >>= sendToPager

main :: IO ()
main =
  do fnom <- getDataFileName "LICENSE"
     putStrLn "Hit Return to start the conduit-free test"
     _ <- getLine
     test fnom
     putStrLn "Hit Return to start the conduit test"
     _ <- getLine
     testConduit fnom
     putStrLn "Hit Return to start the printOrPage test (no conduits)"
     _ <- getLine
     testPrintOrPage fnom