on master help sign in
Cabal target for the IO coverage tests
commit2af9571fe29df5b056b06022c3af9e4e05d45a0a authorJasper Van der Jeugt <jaspervdj@gmail.com> dateTue 21 Jun 2011, 11:02 (15 years ago) parent8edbde4
2 files changed+66−16
tests/tests/src/Data/Text/Tests/IO.hs+34 tests/tests/text-tests.cabal+32−16
tests/tests/src/Data/Text/Tests/IO.hsnew file+34
@@ -0,0 +1,34 @@
1+-- | Program which exposes some haskell functions as an exutable. The results
2+-- and coverage of this module is meant to be checked using a shell script.
3+--
4+module Main
5+ (
6+ main
7+ ) where
8+
9+import System.Environment (getArgs)
10+import System.Exit (exitFailure)
11+import System.IO (hPutStrLn, stderr)
12+import qualified Data.Text as T
13+import qualified Data.Text.IO as T
14+import qualified Data.Text.Lazy as TL
15+import qualified Data.Text.Lazy.IO as TL
16+
17+main :: IO ()
18+main = do
19+ args <- getArgs
20+ case args of
21+ ["T.readFile", name] -> T.putStr =<< T.readFile name
22+ ["T.writeFile", name, t] -> T.writeFile name (T.pack t)
23+ ["T.appendFile", name, t] -> T.appendFile name (T.pack t)
24+ ["T.interact"] -> T.interact id
25+ ["T.getContents"] -> T.putStr =<< T.getContents
26+ ["T.getLine"] -> T.putStrLn =<< T.getLine
27+
28+ ["TL.readFile", name] -> TL.putStr =<< TL.readFile name
29+ ["TL.writeFile", name, t] -> TL.writeFile name (TL.pack t)
30+ ["TL.appendFile", name, t] -> TL.appendFile name (TL.pack t)
31+ ["TL.interact"] -> TL.interact id
32+ ["TL.getContents"] -> TL.putStr =<< TL.getContents
33+ ["TL.getLine"] -> TL.putStrLn =<< TL.getLine
34+ _ -> hPutStrLn stderr "invalid directive!" >> exitFailure
tests/tests/text-tests.cabal+32−16
@@ -1,19 +1,19 @@
1−name: text-tests
2−version: 0.0.0.0
3−synopsis: Functional tests for the text package
4−description: Functional tests for the text package
5−homepage: https://bitbucket.org/bos/text
6−license: BSD3
7−license-file: ../../LICENSE
8−author: Jasper Van der Jeugt <jaspervdj@gmail.com>,
9− Bryan O'Sullivan <bos@serpentine.com>,
10− Tom Harper <rtomharper@googlemail.com>,
11− Duncan Coutts <duncan@haskell.org>
12−maintainer: Bryan O'Sullivan <bos@serpentine.com>
13−category: Text
14−build-type: Simple
15−
16−cabal-version: >=1.2
1+name: text-tests
2+version: 0.0.0.0
3+synopsis: Functional tests for the text package
4+description: Functional tests for the text package
5+homepage: https://bitbucket.org/bos/text
6+license: BSD3
7+license-file: ../../LICENSE
8+author: Jasper Van der Jeugt <jaspervdj@gmail.com>,
9+ Bryan O'Sullivan <bos@serpentine.com>,
10+ Tom Harper <rtomharper@googlemail.com>,
11+ Duncan Coutts <duncan@haskell.org>
12+maintainer: Bryan O'Sullivan <bos@serpentine.com>
13+category: Text
14+build-type: Simple
15+
16+cabal-version: >=1.2
1717
1818flag hpc
1919 description: Enable HPC to generate coverage reports
@@ -48,3 +48,19 @@ executable text-tests
4848 random >= 1.0 && < 1.1,
4949 test-framework >= 0.4 && < 0.5,
5050 test-framework-quickcheck2 >= 0.2 && < 0.3
51+
52+executable text-tests-stdio
53+ hs-source-dirs: src ../..
54+ main-is: Data/Text/Tests/IO.hs
55+
56+ ghc-options:
57+ -Wall
58+ -threaded
59+
60+ -- Optional HPC support
61+ if flag(hpc)
62+ ghc-options:
63+ -fhpc
64+
65+ build-depends:
66+ base >= 4 && < 5