Commits

Jasper Van der Jeugt committed c5c8913

Separate module for main function

  • Participants
  • Parent commits 9e1e116

Comments (0)

Files changed (4)

File tests/tests/.ghci

+:set -DHAVE_DEEPSEQ -isrc -i../..

File tests/tests/src/Data/Text/Tests.hs

+-- | Provides a simple main function which runs all the tests
+--
+module Main
+    ( main
+    ) where
+
+import Test.Framework (defaultMain)
+
+import Data.Text.Tests.Properties (tests)
+
+main :: IO ()
+main = defaultMain tests

File tests/tests/src/Data/Text/Tests/Properties.hs

 {-# LANGUAGE BangPatterns, FlexibleInstances, OverloadedStrings,
              ScopedTypeVariables, TypeSynonymInstances, CPP #-}
 {-# OPTIONS_GHC -fno-enable-rewrite-rules #-}
+module Data.Text.Tests.Properties
+    (
+      tests
+    ) where
 
 import Test.QuickCheck
 import Test.QuickCheck.Monadic
     | n > 0     = S.Stream arr off (smaller (exactSize n) len) 
     | otherwise = t
 
-main :: IO ()
-main = defaultMain tests
-
 tests :: [Test]
 tests = [
   testGroup "creation/elimination" [

File tests/tests/text-tests.cabal

 
 cabal-version:       >=1.2
 
+flag hpc
+  description: Enable HPC to generate coverage reports
+  default:     False
+
 executable text-tests
   hs-source-dirs: src ../..
-  main-is:        Data/Text/Tests/Properties.hs
+  main-is:        Data/Text/Tests.hs
 
   ghc-options:
     -Wall
     -fno-warn-orphans
     -fno-warn-missing-signatures 
 
+  -- Optional HPC support
+  if flag(hpc)
+    ghc-options:
+      -fhpc
+
   cpp-options:
     -DASSERTS
     -DHAVE_DEEPSEQ