Cool stuff! I'll have a look later. Thanks. On Sat, Aug 7, 2010 at 9:53 PM, Nick Sabalausky <[email protected]> wrote:
> "Andrej Mitrovic" <[email protected]> wrote in message > news:[email protected]... > > You know, I just had an idea. It would be really cool to have some sort > of > > generalized template function which can test other functions in various > > ways. You could pass strings as options, where you might choose the type > > of > > testing being done, such as verification tests or performance tests.. Or > > if > > a function is designed to write a file on disk, maybe you'd want to have > > an > > option for the maximum number of tests to run on that function (you don't > > want to be left with 10000 files written in some temp directory > > somewhere..), or a test to see if a function will fail with invalid > input, > > etc. > > > > Well it's just an idea, I better take a look at the existing test > > frameworks > > and see how it's done there. > > > > Probably not quite as fancy as what you're talking about, but my SemiTwist > D > Tools library has a module that includes something that's similar to assert > but: > > - Allows to you verify that a particular statement throws a particular type > of exception. > - Properly reports if an expression throws (and you didn't expect it to). > - Doesn't abort the program on failure. > - Reports "expected" expression and "actual" value. > > > http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/apps/tests/deferAssertTest/main.d > > http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/deferAssert.d > > It does need some clean-up and improvements, but it at least works. > (Although, trunk is currently in the process of switching from D1/Tango to > D2/Phobos, so the latest revisions might be broken and it definitely > doesn't > take advantage of D2-specific features yet. But the version included with > Goldie 0.3 does work fine on D1/Tango though). > > >
