unittest behavior

Steven Schveighoffer schveiguy at yahoo.com
Mon Jul 12 11:52:55 PDT 2010


On Mon, 12 Jul 2010 12:38:47 -0400, eris <jvburnes at gmail.com> wrote:

> Assuming -unittest is asserted, should a D compiler generate and run  
> unittest
> code for classes that have unittests, but don't reference the class  
> during
> execution?
>
> I noticed that gdc does compile them in, but the current version of ldc  
> doesn't.

I would assume that it's because ldc is better at trimming out unused code.

However, I'd say it's annoying that you have to actually use the object in  
question.  But on top of that, I'd say that in unit test mode, all unit  
tests compiled should assume to be called because the runtime will call  
them, even if main doesn't.

You should file a bug against ldc.

-Steve


More information about the Digitalmars-d mailing list