Just A Summary

Piers Cawley Practices Punditry

Test::Class::Sugar released 2

Posted by Piers Cawley Mon, 06 Apr 2009 10:15:00 GMT

I’ve just pushed the second version of Test::Class::Sugar (first discussed here). It’s pretty much as discussed in the original article, but after some discussion with David Wheeler, I’ve dropped the +uses clause from the testclass declaration in favour of less DWIMmy (and thus easier to explain behaviour).

I’ve also introduced a defaults argument at use time. The only working default in this release is one which lets you specify the prefix used to derive the test class name from the class/module under test. I’ve documented a couple of extra and so far unimplemented defaults as well.

Have a play, you might like it.

Comments

Leave a response

  1. Avatar
    Ovid about 2 hours later:

    Looks great. One potential problem, though, is the ‘autonaming’. I screwed up in my Test::Class article because I forgot to point out the obvious problem: the Test:: prefix is going to make your life miserable when you have a namespace clash. Let people choose their own prefix, default it to the package they’re already in or make the prefix something safe like MyTest::.

  2. Avatar
    Piers Cawley about 2 hours later:

    Hmm… yeah, defaulting to something other than ‘Test’ might not be a bad idea. At least you can give it a different default at use time now. I’ve found that, because the syntax is clean, it’s easy to write multiple test classes per .t file, but I can see that others may not be so keen on that. Maybe I’ll make it default to TestExercising instead.

Comments



Just A Summary