On Jul 6, 2010, at 10:31 AM, Walter Bright wrote:
>
> Sean Kelly wrote:
>>
>>
>> How about this... the unittest handler only returns an error code and if
>> it's nonzero then the app won't run. That's consistent with the pre-assert
>> change behavior. The difference being that even if the unittests are
>> successful, to prevent the app from running, a non-zero error should be
>> returned. It's been so long since I originally implemented this (it was
>> done for Gregor when I was working on Tango) that I don't recall the exact
>> use case he presented, but it seems reasonable that if you run an app and it
>> runs some tests but doesn't actually execute then the return value should be
>> nonzero, even if all the tests succeed. What do you think?
>>
>>
>
> I don't see the point in doing anything more complicated than:
>
> run unit tests
> if (any unit tests failed)
> exit (1)
I think the original idea was to allow standalone unit testing to occur using
the application binary. I'm not entirely sure what's to be gained over this
approach versus having a separate build with -unittest turned on and a
different main() however, since I can't see it being desirable to run unit
tests before every execution of an app (except possibly when the unit tests are
used to determine whether the environment is configured correctly rather than
detailed white-box testing). In short, I'm going to change it to work pretty
much exactly how you want.
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos