Is phobos too fluffy?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sat Sep 19 09:24:05 UTC 2020


On Saturday, September 19, 2020 3:15:01 AM MDT Imperatorn via Digitalmars-d 
wrote:
> On Saturday, 19 September 2020 at 06:59:54 UTC, Jonathan M Davis
>
> wrote:
> > On Friday, September 18, 2020 6:05:39 AM MDT Imperatorn via
> >
> > Digitalmars-d wrote:
> >> On Friday, 18 September 2020 at 07:41:25 UTC, mw wrote:
> >> > On Friday, 18 September 2020 at 06:50:48 UTC, Imperatorn
> >
> > No. It's very common practice in D code to put the tests
> > immediately after the code that they're testing. It makes it
> > far easier to make sure that everything has tests as well
> > making it easier to maintain the code and ensure that the code
> > and tests are properly in sync. In addition to that, if a
> > unittest block immediately after a symbol is marked with a ddoc
> > comment, then it gets added to the documentation for that
> > symbol, making it easy to add examples to the documentation and
> > have those examples be tested whenever you run the unit tests
> > without having to duplicate the examples and worry about
> > whether they're in sync between the documentation and the tests.
> >
> >...
> >
> > - Jonathan M Davis
>
> "It's very common practice"
>
> Actually no it is not. D is the only example I've seen that
> routinely does this. Virtually all other languages separate code
> and tests.

I specifically said that it was very common practice _in D code_. You
couldn't do it with most other languages even if you wanted to, because they
don't have unit test functionality built into the language.

- Jonathan M Davis





More information about the Digitalmars-d mailing list