name: test-framework-th version: 0.1.3 x-revision: 1 cabal-version: -any build-type: Simple license: BSD3 maintainer: Oscar Finnsson build-depends: base >= 4 && < 5, test-framework, language-haskell-extract, haskell-src-exts, haskell98 < 2, regex-posix, template-haskell stability: homepage: http://github.com/finnsson/test-generator package-url: bug-reports: synopsis: Automagically generate the HUnit- and Quickcheck-bulk-code using Template Haskell. description: @test-framework-th@ contains two interesting functions: @defaultMainGenerator@ and @testGroupGenerator@. . @defaultMainGenerator@ will extract all functions beginning with case_ or prop_ in the module and put them in a testGroup. . > -- file SomeModule.hs > ( -# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell #- ) > module SomeModule where > import Test.Framework.TH > import Test.Framework > import Test.HUnit > import Test.Framework.Providers.HUnit > import Test.Framework.Providers.QuickCheck2 > > -- observe this line! > main = $(defaultMainGenerator) > case_1 = do 1 @=? 1 > case_2 = do 2 @=? 2 > prop_reverse xs = reverse (reverse xs) == xs > where types = xs::[Int] . is the same as . > -- file SomeModule.hs > ( -# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell #- ) > module SomeModule where > import Test.Framework.TH > import Test.Framework > import Test.HUnit > import Test.Framework.Providers.HUnit > import Test.Framework.Providers.QuickCheck2 > > -- observe this line! > main = > defaultMain [ > testGroup "SomeModule" [ testCase "1" case_1, testCase "2" case_2, testProperty "reverse" prop_reverse] > ] > > case_1 = do 1 @=? 1 > case_2 = do 2 @=? 2 > prop_reverse xs = reverse (reverse xs) == xs > where types = xs::[Int] . @testGroupGenerator@ is like @defaultMainGenerator@ but without @defaultMain@. It is useful if you need a function for the testgroup (e.g. if you want to be able to call the testgroup from another module). category: Testing author: Oscar Finnsson & Emil Nordling tested-with: data-files: data-dir: "" extra-source-files: extra-tmp-files: exposed-modules: Test.Framework.TH exposed: True buildable: True build-tools: cpp-options: cc-options: ld-options: pkgconfig-depends: frameworks: c-sources: extensions: extra-libraries: extra-lib-dirs: includes: install-includes: include-dirs: hs-source-dirs: src other-modules: ghc-prof-options: ghc-shared-options: ghc-options: hugs-options: nhc98-options: jhc-options: