unittest "name" {}

Mike Shah mshah.475 at gmail.com
Sat Feb 11 21:09:43 UTC 2023


>> Question to the community: do you name tests, and do you like 
>> the idea?

Definitely like the ability for named tests.

The output would be much cleaner if we could see per module how 
many unittest blocks passed along with the name of the passing or 
failing test.

It seems the proposal right now is just for a simpler naming 
scheme rather than having to use UDAs?

On Friday, 10 February 2023 at 21:45:29 UTC, ProtectAndHide wrote:

> On Friday, 10 February 2023 at 21:21:30 UTC, ProtectAndHide 
> wrote:
>>
>>
>> Also maybe a way to tell the compiler what unittest to run 
>> perhaps (i.e. passing in the name of the unittest (all 
>> unittests being the default).
>>
>> unittest : myQuicktest // dmd -unittest:myQuicktest
>> {
>>
>> }
>>
>> unittest : myLongtest // dmd -unittest:myLongtest
>> {
>>
>> }
>
> better be consistent here as well:
>
> dmd -unittest                          (as per current. runs 
> all unittests)
> dmd -unittest=myQuicktest              (runs only that named 
> unittest)
> dmd -unittest=myQuicktest,myLongtest   (runs these named 
> unittests only)

Agreed, being able to select and run selected subsets of unit 
tests as suggested would be incredibly useful.

Perhaps distinguishing between running 'private unittest' may be 
useful as well.

dmd -unittest             // Runs all unit tests
dmd -unittest=all         // Default, runs all unit tests
dmd -unittest=private     // All private unittest
dmd -unittest=myQuicktest // Runs specific named test
dmd -unittest=myQuicktest,myLongtest // Run two or more tests

While this discussion is happening, I wonder what the most 
popular framework is currently for testing (perhaps 
https://github.com/atilaneves/unit-threaded ?).

Might be some inspiration there (others probably know better than 
I about these frameworks) if any language level changes are made 
for the longer term.





More information about the Digitalmars-d mailing list