[Haskell-beginners] edit-compile-test loop

Magnus Therning magnus at therning.org
Mon Oct 19 09:33:36 EDT 2009


On Mon, Oct 19, 2009 at 12:25 PM, Roel van Dijk <vandijk.roel at gmail.com> wrote:
>> [1] right now I use my own little hacked up testrunning script (just loads
>> the stuff in ghci, and I have one function that sits in a base "test"
>> directory, underwhich the project module hierarchy is mirrored. So if I
>> have, as I do now, Text/HWN/Parser/HWN.hs, then I also have
>> Test/Text/HWN/Parser/HWN_Test.hs. in the Test directory I have
>> Test_Harness.hs, which has a main function which runs all the tests in the
>> directories below it. Each directory has a similar Test_Harness.hs (though
>> all the names are different) which loads all the tests of the directories
>> below it, and exports a single test group. All of this is manual, though
>> I've been planning a kind of manager thing for it lately. But thats a story
>> for another day.
>
> I found the test-framework package to be quite useful for this.
>
> http://batterseapower.github.com/test-framework/
>
> Using the defaultMain function you can easily define a small program
> which will run all your tests (quickcheck, hunit or other). The only
> problem I had with test-framework is that it prints the test results
> in nice colours. It looks pretty in a console but unreadable in ghci.
>
> Hackage seems to be down at the moment, but you can check out which
> other packages use test-framework on my hackage plaything:
>
> http://bifunctor.homelinux.net/~roel/cgi-bin/hackage-scripts/revdeps/test-framework

Yes, I've found this useful as well.  I'm surprised it's not possible
to turn off the colourisation... but `my-test --help` doesn't seem to
offer any option for it.  Maybe that's a good thing to add?  ;-)

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Beginners mailing list