`unittest` placement in code?

2020-10-26 Thread Vladimirs Nordholm via Digitalmars-d-learn
Hello. I have a class which I have written some tests for, to ensure if I ever change some code it will still work as intended. The documentation https://dlang.org/spec/unittest.html says it is can be placed both in the class or outside it. I come from a background of having a completely se

Re: `unittest` placement in code?

2020-10-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/26/20 9:16 AM, Vladimirs Nordholm wrote: Hello. I have a class which I have written some tests for, to ensure if I ever change some code it will still work as intended. The documentation https://dlang.org/spec/unittest.html says it is can be placed both in the class or outside it. I

Re: `unittest` placement in code?

2020-10-26 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Monday, 26 October 2020 at 13:36:58 UTC, Steven Schveighoffer wrote: On 10/26/20 9:16 AM, Vladimirs Nordholm wrote: [...] Wherever you want. Generally people put it right after the thing being tested to keep files organized. When the compiler runs unittests it runs them all in the seque

Re: `unittest` placement in code?

2020-10-26 Thread Anonymouse via Digitalmars-d-learn
On Monday, 26 October 2020 at 13:16:32 UTC, Vladimirs Nordholm wrote: Hello. [...] Additionally, if you care about generating documentation, then placing them after whatever is being tested can make them end up as examples (of how to use them). Handy if your unittests shows how they're used