tag:blogger.com,1999:blog-21123659.post605944240072195439..comments2023-05-03T09:30:17.042+02:00Comments on koweycode: some ideas for practical QuickCheckkoweyhttp://www.blogger.com/profile/11175806459477851520noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-21123659.post-1404816847234444552010-08-31T20:45:22.617+02:002010-08-31T20:45:22.617+02:00The System.FilePath import appears to be problemat...The System.FilePath import appears to be problematic on Hackage- it produces build failures as <a href="http://hackage.haskell.org/packages/archive/bits-atomic/0.1.1/logs/failure/ghc-6.12" rel="nofollow">this one</a>.<br /><br />A slighly less clean (but hackage-friendly) variant picks the path separators using CPP, see e.g. <a href="http://dev.wikidev.net/hg/bits-atomic/file/25c3e5a8e3f0/Setup.hs" rel="nofollow">this Setup.hs</a>.Gabrielnoreply@blogger.comtag:blogger.com,1999:blog-21123659.post-90467299266795773362010-02-26T13:13:49.500+01:002010-02-26T13:13:49.500+01:00There are loads of imports missing in that Setup.h...There are loads of imports missing in that Setup.hs example: Distribution.PackageDescription, Distribution.Simple, Distribution.Simple.{LocalBuildInfo,Setup}.<br /><br />Sorry for that!koweyhttps://www.blogger.com/profile/11175806459477851520noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-13790464909637977762010-02-23T01:51:09.873+01:002010-02-23T01:51:09.873+01:00Thank you Eric, this has been helpful !Thank you Eric, this has been helpful !Paul Braunerhttps://www.blogger.com/profile/17812487450262251135noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-63954876997287001692009-07-29T11:36:33.815+02:002009-07-29T11:36:33.815+02:00Peter: anything that will let me write less code i...Peter: anything that will let me write less code is welcome! I'll add it to my list of things to try.<br /><br />Echo and Ivan: points taken. Ivan, I don't really mind making folks install QC because it just automagically happens with cabal anyway, although I do sympathasise more with Echo's point that people might like more control, for example over QC version numbers.<br /><br />I definitely seem to be in the minority here about mixing tests with code, and also about baking them in and probably for good reason. Hopefully I will figure it out before I have to learn the hard way!koweyhttps://www.blogger.com/profile/11175806459477851520noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-30436040974277390512009-07-29T04:08:55.941+02:002009-07-29T04:08:55.941+02:00Mark Wotton and I have recently tried to address t...Mark Wotton and I have recently tried to address this problem. TBC has Cabal integration, a fact I should have pushed more in my haskell-cafe announcement.<br /><br />Hackage: http://hackage.haskell.org/package/TBC<br /><br />It makes tests easy to run by adopting conventions for identifiers, e.g. "prop_blah" is a QuickCheck property, etc. No more forgetting to add tests to lists!<br /><br />The other key feature is that it will run all runnable tests, so you can actually do test-driven development.<br /><br />"cabal test" is broken, forget about it for now. TBC provides a hook but it is a lot more primitive than the 'tbc' binary. A quick look at Cabal's trac will show that the 'test' hook has been in need of love for years.<br /><br />TBC is agnostic about where the tests go - conventionally, separate tests go in $PROJECT/Tests, but you could bake them into your source code if you like.<br /><br />Please try it out and give us some feedback.<br /><br />Thanks,<br />Peter.Peterhttp://peteg.org/noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-34446546189072388472009-07-29T02:59:56.496+02:002009-07-29T02:59:56.496+02:00My problem with having a --test option to your pro...My problem with having a --test option to your program is that you then require that users (who usually don't care about tests) must install QC just to build it.Unknownhttps://www.blogger.com/profile/03307455728042469226noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-79883566952569119192009-07-28T23:57:08.708+02:002009-07-28T23:57:08.708+02:00I've another reason to separate tests from fun...I've another reason to separate tests from functionality: simplifying dependencies. Since my tests are in their own files and have their own executable section in my .cabal, the main of the program doesn't need to depend on QuickCheck/HUnit/etc. This is a win if someone ever wants to link my library and use, e.g. QuickCheck-1 rather than QuickCheck-2.Echo Nolannoreply@blogger.comtag:blogger.com,1999:blog-21123659.post-65358229307053499842009-07-28T22:06:46.710+02:002009-07-28T22:06:46.710+02:00Thanks for the link! For the moment, my test logi...Thanks for the link! For the moment, my test logic looks like it's cleanly separated from the rest of my code, no crazy interleaving (thanks to the functional style, perhaps?). But it's interesting to consider.<br /><br />I know some great programmers who are pretty clear that this is a bad idea, so maybe I will burn my fingers on this :-)koweyhttps://www.blogger.com/profile/11175806459477851520noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-8360471094034695852009-07-28T21:53:44.428+02:002009-07-28T21:53:44.428+02:00I don't think it's a good idea to put test...I don't think it's a good idea to put test code in the production code. Check <a href="http://xunitpatterns.com/Test%20Logic%20in%20Production.html" rel="nofollow">this</a> out!LAcahttps://www.blogger.com/profile/15589207265488926762noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-43906780620741668222009-07-28T19:56:06.893+02:002009-07-28T19:56:06.893+02:00Very useful post; this is exactly the kind of stuf...Very useful post; this is exactly the kind of stuff that helps smooth the bumps when starting Haskell. Thanks a lot!<br /><br />With this motivation, I'll just have to (finally!) write some tests when I get off work. ;-)Unknownhttps://www.blogger.com/profile/13108536303040847002noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-85852914741189441932009-07-28T19:05:10.281+02:002009-07-28T19:05:10.281+02:00Good luck with that! Don't forget to set your...Good luck with that! Don't forget to set your build type with Custom and do heed the disclaimer about me not necessarily being in a position to give advice about these sorts of things :-)koweyhttps://www.blogger.com/profile/11175806459477851520noreply@blogger.comtag:blogger.com,1999:blog-21123659.post-57451593974815347042009-07-28T15:29:41.295+02:002009-07-28T15:29:41.295+02:00I've been looking for a post like this, especi...I've been looking for a post like this, especially the cabal integration. Can't wait to try it out.<br /><br />I waffle on where to keep the tests. I've grown up with test being separate, but then I have to export functions that I don't want exposed outside of the module.Wilkes Joinerhttps://www.blogger.com/profile/16667352630170810773noreply@blogger.com