Properties for unittests

Lodovico Giaretta via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 2 04:25:51 PDT 2016


On Saturday, 2 July 2016 at 11:03:16 UTC, qznc wrote:
> In general, it is a good idea to make unittests @safe and @nogc 
> in Phobos. When reviewing a pull request, we should check that.
>
> There is a pull request [0] which annotates @system. Why would 
> you do that? Is that somehow a desirable thing? Should a 
> reviewer check for that?
>
> The spec for @system [1] says:
>
>> System functions are functions not marked with @safe or 
>> @trusted and are not nested inside @safe functions. System 
>> functions may be marked with the @system attribute. A function 
>> being system does not mean it actually is unsafe, it just 
>> means that the compiler is unable to verify that it cannot 
>> exhibit undefined behavior.
>
> [0] https://github.com/dlang/phobos/pull/4532
> [1] https://dlang.org/spec/function.html#property-functions

What emerged in a previous thread[1], unittests that can't be 
@safe have to be explicitly marked @system, so that it is obvious 
to the reader that the functionalities tested are not @safe.

[1] http://forum.dlang.org/thread/nkn1g6$b00$1@digitalmars.com


More information about the Digitalmars-d mailing list