text / tests / StdioCoverage.hs

The default branch has multiple heads

import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.IO as TL
import System.Environment (getArgs)
import System.Exit (exitFailure)
import System.IO (hPutStrLn, stderr)

main = do
  args <- getArgs
  case args of
    ["T.readFile", name] -> T.putStr =<< T.readFile name
    ["T.writeFile", name, t] -> T.writeFile name (T.pack t)
    ["T.appendFile", name, t] -> T.appendFile name (T.pack t)
    ["T.interact"] -> T.interact id
    ["T.getContents"] -> T.putStr =<< T.getContents
    ["T.getLine"] -> T.putStrLn =<< T.getLine

    ["TL.readFile", name] -> TL.putStr =<< TL.readFile name
    ["TL.writeFile", name, t] -> TL.writeFile name (TL.pack t)
    ["TL.appendFile", name, t] -> TL.appendFile name (TL.pack t)
    ["TL.interact"] -> TL.interact id
    ["TL.getContents"] -> TL.putStr =<< TL.getContents
    ["TL.getLine"] -> TL.putStrLn =<< TL.getLine
    _ -> hPutStrLn stderr "invalid directive!" >> exitFailure
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.