The testCom package

[ Tags: gpl, library, test ] [ Propose Tags ]

With some TemplateHaskell magic, you can write your tests in your comments directly above a function declaration with a minimalistic syntax.

[Skip to Readme]


Versions 0.1.0, 0.1.1, 0.2.0
Change log
Dependencies base (>=4.9 && <4.11), haskell-src-meta (>=, template-haskell (>= [details]
License GPL
Author Alexandre Moine
Category Test
Bug tracker
Source repository head: git clone git://
Uploaded Thu Sep 28 14:50:16 UTC 2017 by nobrakal
Downloads 118 total (118 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for testCom-0.2.0

[back to package description]


How to use it

Write your tests

Above a function to test, write your test like this:

--[1 2] [3]
add :: Int -> Int -> Int
add x y = x+y

Run them

For example

{-# LANGUAGE TemplateHaskell #-}

import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import System.Exit

$(makeAllTests "some/Path/File.hs")

-- Tests
main :: IO ()
main = do
  let (str,res) = _TEST_path -- Here, path=directory_actualfile. If your file is put in tests/Main.hs, then path=tests_Main (without the ".hs")
  let (str',res') = _TEST_some_Path_File
  putStrLn str
  putStrLn str'
  if res && res' then exitSuccess else exitFailure


  • Encapuslate parse error.