-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Write your tests in comments -- -- With some TemplateHaskell magic, you can write your tests in your -- comments directly above a function declaration with a minimalistic -- syntax. @package testCom @version 0.1.0 -- |
-- --[1 2 3] -- add x y = x+y -- ---- -- Later, on your test file, you can build tests functions with -- --
-- {-# LANGUAGE TemplateHaskell #-}
-- $(makeAllTests "some/Path/File.hs")
--
--
--
-- and use the produced function in your main:
--
-- -- import System.Exit -- -- main :: IO () -- main = do -- let (str,res) = _TEST_some_Path_File -- putStrLn str -- if res then exitSuccess else exitFailure -- ---- -- If you want to make tests on the actual file, you can use -- --
-- $(makeAllTestsHere) -- ---- -- the function produced will be equivalent to the one produced by -- --
-- $(makeAllTests "path/to/file/known/by/ghc") -- ---- --
-- --[1 2 3] -- --[1 2 4] -- add x y = x+y -- ---- -- The string produced will be: -- --
-- Test passed: add 1 2 == 3 -- Error: add 1 2 /= 4 BUT == 3 -- --module Test.TestCom -- | With a path like some/Path/File.hs, Create a function -- --
-- _TEST_some_Path_File :: (String,Bool) ---- -- with the string containing the result of all tests, and the boolean -- set to True if and only if all tests passed -- -- This also create sub-functions that each produce a Eihter String -- String makeAllTests :: FilePath -> Q [Dec] makeAllTestsHere :: Q [Dec] instance GHC.Show.Show Test.TestCom.TestT