Thread overview
[Issue 17882] [The D Style] unittest attributes
Oct 07, 2017
b2.temp@gmx.com
Oct 07, 2017
b2.temp@gmx.com
Oct 07, 2017
Mario Kroeplin
Oct 07, 2017
b2.temp@gmx.com
Mar 21, 2020
Basile-z
October 07, 2017
https://issues.dlang.org/show_bug.cgi?id=17882

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp@gmx.com
         Resolution|---                         |INVALID

--- Comment #1 from b2.temp@gmx.com ---
attributes of the unittest blocks are tried on the free functions that are used
inside. Actually you can see a unittest{} as a function itself. (the
getunittests traits returns some void function()).

--
October 07, 2017
https://issues.dlang.org/show_bug.cgi?id=17882

--- Comment #2 from b2.temp@gmx.com ---
to be perfectly clear about the invalidity, see:

https://dlang.org/spec/function.html#function-attribute-inference


void call1 () @safe{} // non templatized so no attrib inference
void call2 ()(){} // attrib infered by the caller

@safe unittest
{
  // everything inside **must** be safe or trused.
  call1();
  call2();
}

//is like

void test() @safe
{
  call1();
  call2(); // @safe is infered on call2, so that if not supported compil stops.
}

--
October 07, 2017
https://issues.dlang.org/show_bug.cgi?id=17882

Mario Kroeplin <kroeplin.d@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #3 from Mario Kroeplin <kroeplin.d@googlemail.com> ---
(In reply to b2.temp from comment #2)

The issue is just the wording of the guideline:
"to ensure the existence of attributes on the templated function":
which "templated function"?

--
October 07, 2017
https://issues.dlang.org/show_bug.cgi?id=17882

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from b2.temp@gmx.com ---
(In reply to Mario Kroeplin from comment #3)
> (In reply to b2.temp from comment #2)
> 
> The issue is just the wording of the guideline:
> "to ensure the existence of attributes on the templated function":
> which "templated function"?

in the example it's "call2". Maybe if you're not comfy enough with D try

https://forum.dlang.org/group/learn

before opening an issue.

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=17882

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--