Hack to name unit tests?
Robert Fraser
fraserofthenight at gmail.com
Wed Nov 28 12:51:43 PST 2007
I'm creating a Flectioned-based way to run unit tests individually
(it'll be hooked into a front-end, so you can run test suites, repeat
only failed tests after a code change, etc.)
However, I have run into a problem: unit tests can't be named. Right now
I have a signature system, but I was wondering if there's any hackish
way to predictably insert a string into the generated object file in a
way that users can name unittests. That is to say, given a function
pointer, is there any way I can scan the code to see if a name has been
given to the unit test, and if so extract that name at runtime?
Ideally, it'd be as easy for the user as something like:
unittest
{
assert(":testName:");
// Rest of test goes here...
}
Right now, I have the associations being done in the front-end I'm
working on, that scans the code for comments in a particular format and
associates those with the unit tests. However, that ties the unit test
executor back-end to the code analysis front-end, so I was hoping
there's a better way.
Thanks!
More information about the Digitalmars-d
mailing list