function vs. delegate in a unittest

Manfred Nowak sv1999 at hotmail.com
Sun Apr 21 06:35:03 UTC 2019


Because unittests are special functions, the functions declared 
within the body of a unittest have the type of a `delegate'. By 
this the intent to include a unittest for functions with the type 
of a `function' requires the definition of a function outside of 
the body of the unittest.

1: In the docs for unittesting 
https://dlang.org/spec/unittest.html this is a case of usage of 
`version( unittest)' in currently number "7.".

2: Has someone proven, that a super type for `function' and 
`delegate' is not existent or too difficult to implement in the 
compiler? Or is there a good reason for requiring coders to 
manage different versions for both types of functions?


More information about the Digitalmars-d mailing list