www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Properties for unittests

reply qznc <qznc web.de> writes:
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
Jul 02 2016
parent reply Lodovico Giaretta <lodovico giaretart.net> writes:
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
Jul 02 2016
parent reply Lodovico Giaretta <lodovico giaretart.net> writes:
On Saturday, 2 July 2016 at 11:25:51 UTC, Lodovico Giaretta wrote:
 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
This post in particular: http://forum.dlang.org/post/nkn25t$btk$1 digitalmars.com
Jul 02 2016
parent reply qznc <qznc web.de> writes:
On Saturday, 2 July 2016 at 11:27:57 UTC, Lodovico Giaretta wrote:
 On Saturday, 2 July 2016 at 11:25:51 UTC, Lodovico Giaretta 
 wrote:
 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
This post in particular: http://forum.dlang.org/post/nkn25t$btk$1 digitalmars.com
Thanks. I added this to the wiki: https://wiki.dlang.org/Get_involved#Review_pull_requests
Jul 02 2016
parent Seb <seb wilzba.ch> writes:
On Saturday, 2 July 2016 at 11:50:15 UTC, qznc wrote:
 On Saturday, 2 July 2016 at 11:27:57 UTC, Lodovico Giaretta 
 wrote:
 On Saturday, 2 July 2016 at 11:25:51 UTC, Lodovico Giaretta 
 wrote:
 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
This post in particular: http://forum.dlang.org/post/nkn25t$btk$1 digitalmars.com
Thanks. I added this to the wiki: https://wiki.dlang.org/Get_involved#Review_pull_requests
Once all unittests in Phobos have annotations, we should enable an automatic test with Travis. Could be a simple Dscanner plugin.
Jul 02 2016