HTF doesn't seem to directly support this mode of operation. You can however achieve the goal with some hackery:
A.hs
{-# OPTIONS_GHC -F -pgmF htfpp #-}
module A where
import Test.Framework
funA :: Int -> Int
funA x = x + 1
test_funA = assertEqual (funA 41) 42
B.hs
{-# OPTIONS_GHC -F -pgmF htfpp #-}
module B where
import Test.Framework
funB :: Int -> Int
funB x = x + 1
test_funB = assertEqual (funB 41) 42
C.hs
module C where
import Test.Framework.TestManager
import A
import B
htf_C_thisModulesTests =
makeAnonTestSuite $ map testSuiteAsTest
[ htf_A_thisModulesTests
, htf_B_thisModulesTests
]
TestMain.hs:
{-# OPTIONS_GHC -F -pgmF htfpp #-}
module TestMain where
import Test.Framework
import {-@ HTF_TESTS @-} C
main = htfMain htf_importedTests
This works, but the problem is that we have to hardcode the module names in C.hs
. I think a good idea would be to introduce a new delegate_
test definition statement that allows you to delegate a test to another TestableHTF
, so that we can export htf_importedTests
as a single test. Maybe you can open a feature request for that or different solution to the problem.