tdd-util 0.3.0.0 → 0.3.0.1
raw patch · 2 files changed
+9/−8 lines, 2 filesdep +string-class
Dependencies added: string-class
Files
- tdd-util.cabal +3/−2
- testsrc/Test/Test/Util.hs +6/−6
tdd-util.cabal view
@@ -1,5 +1,5 @@ name: tdd-util-version: 0.3.0.0+version: 0.3.0.1 cabal-version: >= 1.10 build-type: Simple license: BSD3@@ -303,6 +303,7 @@ ,test-framework ,test-framework-hunit ,test-framework-quickcheck2+ ,string-class if flag(QuickCheck26) cpp-options: -DQUICKCHECK26 build-depends:@@ -318,4 +319,4 @@ source-repository head type: git location: git://github.com/bairyn/tdd-util.git- tag: 0.3.0.0+ tag: 0.3.0.1
testsrc/Test/Test/Util.hs view
@@ -8,7 +8,7 @@ import Control.Monad import Data.Maybe import Data.Proxy-import Data.String+import Data.String.Class (fromStringCells) import System.IO import System.Process import Text.Printf@@ -165,20 +165,20 @@ redirectTests = [ testCase "catchStdout catches the output of Hello World" $ do output <- snd <$> catchStdout helloWorld- fromString "Hello, World!\n" @=? output+ fromStringCells "Hello, World!\n" @=? output , testCase "catchStderr catches the output of a program that prints to stderr" $ do output <- snd <$> catchStderr helloWorldErr- fromString "Hello, World!\n" @=? output+ fromStringCells "Hello, World!\n" @=? output , testCase "catchStdout behaves correctly with exceptions, a test in the middle of other redirectHandle tests" $ do assertThrown Nothing (Proxy :: Proxy IOError) $ do output <- snd <$> catchStdout (throwIO . userError $ "User error!")- fromString "This is not the output." @=? output+ fromStringCells "This is not the output." @=? output , testCase "no stderr is received from hellowWorld" $ do output <- snd <$> catchStderr helloWorld- fromString "" @=? output+ fromStringCells "" @=? output , testCase "no stdout is received from hellowWorldErr" $ do output <- snd <$> catchStdout helloWorldErr- fromString "" @=? output+ fromStringCells "" @=? output ] where helloWorld :: IO () helloWorld = putStrLn "Hello, World!"