Permalink
Browse files

Updated README.markdown. Fixed indentation.

  • Loading branch information...
1 parent d93ce91 commit 87b0b764abe2815fa2281c30aaad06ebe4f5aa1a @finnsson committed Oct 12, 2009
Showing with 42 additions and 42 deletions.
  1. +42 −42 README.markdown
View
84 README.markdown
@@ -4,57 +4,57 @@ Haskell-module to automagically generate repetetive code when writing HUnit-test
## testGroupGenerator
-> -- file SomeModule.hs
-> fooTestGroup = $(testGroupGenerator)
-> main = defaultMain [fooTestGroup]
-> test1 = do 1 @=? 1
-> test2 = do 2 @=? 2
+ -- file SomeModule.hs
+ fooTestGroup = $(testGroupGenerator)
+ main = defaultMain [fooTestGroup]
+ test1 = do 1 @=? 1
+ test2 = do 2 @=? 2
is the same as
-> -- file SoomeModule.hs
-> fooTestGroup = testGroup "SomeModule" [testCase "test1" test1, testCase "test2" test2]
-> main = defaultMain [fooTestGroup]
-> test1 = do 1 @=? 1
-> test2 = do 2 @=? 2
+ -- file SoomeModule.hs
+ fooTestGroup = testGroup "SomeModule" [testCase "test1" test1, testCase "test2" test2]
+ main = defaultMain [fooTestGroup]
+ test1 = do 1 @=? 1
+ test2 = do 2 @=? 2
## defaultMainGenerator
-> {-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell #-}
-> module MyModuleTest where
-> import Test.HUnit
-> import MainTestGenerator
->
-> main = $(defaultMainGenerator)
->
-> testFoo = do 4 @=? 4
->
-> testBar = do "hej" @=? "hej"
+ {-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell #-}
+ module MyModuleTest where
+ import Test.HUnit
+ import MainTestGenerator
+
+ main = $(defaultMainGenerator)
+
+ testFoo = do 4 @=? 4
+
+ testBar = do "hej" @=? "hej"
will automagically extract testFoo and testBar and run them as well as present them as belonging to the testGroup 'MyModuleTest'. The above code is the same as
-> {-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell #-}
-> module MyModuleTest where
-> import Test.HUnit
-> import MainTestGenerator
->
-> main =
-> defaultMain [
-> testGroup "MyModuleTest" [ testCase "testFoo" testFoo, testCase "testBar" testBar]
-> ]
->
-> testFoo = do 4 @=? 4
->
-> testBar = do "hej" @=? "hej"
+ {-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell #-}
+ module MyModuleTest where
+ import Test.HUnit
+ import MainTestGenerator
+
+ main =
+ defaultMain [
+ testGroup "MyModuleTest" [ testCase "testFoo" testFoo, testCase "testBar" testBar]
+ ]
+
+ testFoo = do 4 @=? 4
+
+ testBar = do "hej" @=? "hej"
and will give the following result
-> me: runghc MyModuleTest.hs
-> MyModuleTest:
-> testFoo: [OK]
-> testBar: [OK]
->
-> Test Cases Total
-> Passed 2 2
-> Failed 0 0
-> Total 2 2
+ me: runghc MyModuleTest.hs
+ MyModuleTest:
+ testFoo: [OK]
+ testBar: [OK]
+
+ Test Cases Total
+ Passed 2 2
+ Failed 0 0
+ Total 2 2

0 comments on commit 87b0b76

Please sign in to comment.