{-# LANGUAGE TemplateHaskell #-}
module Test.FileLocation where
import qualified Test.HUnit as HUnit
import Language.Haskell.TH
import FileLocation (locationToString)
import Control.Monad.IO.Class (liftIO)
assertEq :: Q Exp
assertEq :: Q Exp
assertEq = do
Loc
loc <- Q Loc
location
let prefix :: [Char]
prefix = Loc -> [Char]
locationToString Loc
loc [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ " "
[|(\x -> HUnit.assertEqual prefix x)|]
assertB :: Q Exp
assertB :: Q Exp
assertB = do
Loc
loc <- Q Loc
location
let prefix :: [Char]
prefix = Loc -> [Char]
locationToString Loc
loc [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ "assertB "
[|(HUnit.assertBool prefix)|]
assertEq' :: Q Exp
assertEq' :: Q Exp
assertEq' = do
Loc
loc <- Q Loc
location
let prefix :: [Char]
prefix = Loc -> [Char]
locationToString Loc
loc [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ " "
[|(\x -> liftIO . HUnit.assertEqual prefix x)|]
assertB' :: Q Exp
assertB' :: Q Exp
assertB' = do
Loc
loc <- Q Loc
location
let prefix :: [Char]
prefix = Loc -> [Char]
locationToString Loc
loc [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ "assertB "
[|(liftIO . HUnit.assertBool prefix)|]