I have a bunch of functions like: method1 , method2 , method3 . For them there are HUnit test functions, such as: testMethod1 , testMethod2 , testMethod3 .
testMethod1 = TestCase $ assertEqual "testmethod1" ... testMethod2 = TestCase $ assertEqual "testmethod2" ... testMethod3 = TestCase $ assertEqual "testmethod3" ...
I would like to avoid over-copying the function name as an error prefix and name it something like this:
testMethod1 = TestCase $ assertEqual_ ...
How can this be achieved (any "magic" trick appreciated)?
So, the real question is, how can I use the function name inside this definition?
Update .
Actually it is not clear from the original question that I also want to deal with this situation:
tProcess = TestCase $ do assertEqual "tProcess" testResult $ someTest assertEqual "tProcess" anotherTestResult $ anotherTest assertEqual "tProcess" resultAgain $ testAgain
Finally, I want to write something like this:
tProcess = TestCase $ do assertEqual_ testResult $ someTest assertEqual_ anotherTestResult $ anotherTest assertEqual_ resultAgain $ testAgain
DMITRY MALIKOV
source share