Mixin Expressions, can't evalutate string variable

Nick Sabalausky a at a.a
Sat Aug 7 12:53:08 PDT 2010


"Andrej Mitrovic" <andrej.mitrovich at gmail.com> wrote in message 
news:mailman.175.1281208901.13841.digitalmars-d at puremagic.com...
> 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).




More information about the Digitalmars-d mailing list