Static unittests?

monarch_dodra monarchdodra at gmail.com
Mon Aug 5 11:31:58 PDT 2013


On Monday, 5 August 2013 at 18:21:37 UTC, Dicebot wrote:
> On Monday, 5 August 2013 at 17:38:22 UTC, monarch_dodra wrote:
>> So sure, I guess that strictly speaking, no, D language 
>> doesn't have static unittests. However, when someone asks the 
>> question, if you just answer "No" without pointing out that 
>> the language allows this semantic:
>>
>> version(unittest) assertCTFEAble!({
>>    //YOUR CODE HERE
>> });
>>
>> Then I believe you are giving an incomplete answer.
>
> Well, the problem is, D does have static unit-tests in a form 
> of `static assert`. But topic starter has immediately provided 
> an example that shows that his understanding of "static 
> unit-tests" is different one, making it pretty hard to reason 
> about proper alternative.
>
> Even assertCTFEAble does not _exactly_ match what was asked 
> here. Thus I feel the need to first ask about specific use case 
> and only then propose any real solutions.
>
> So, yes, of course, it is incomplete - because question is 
> incomplete and requires further clarification. Which is the 
> main point.

Alright. I tend to try to give as much information as possible in 
answers, even when the question isn't completely clear, or it was 
not exactly what was asked. With some luck, I can provide enough 
information to get the question answered, or give enough 
background to provide better understanding. This may or may not 
be the best thing to do, and sometimes it may indeed be better to 
stop and ask for clarification.

I'll agree my answer is not 100% exact, but I feel it does bring 
something to the conversation. In any case, while it was a 
reply/quote to what you said, it was not meant as a rebutal to 
what you were saying.


More information about the Digitalmars-d mailing list