On Mon, May 20, 2013 at 6:52 PM, Nick Sabalausky <SeeWebsiteToContactMe@semitwist.com> wrote:
Y'know what we need? This compiler flag:

   -unittest=pagkage.name.*

I would like that as well.

Here's a workaround in the meantime:
dmd -c -unittest a;
dmd -c b;
dmd -oftest -main -unittest *.o
./test => will only run unittest of a, not b.

Another thing we need is named unittests:

unittest(my_test_1){...}

It's been requested so many times and I still don't get the arguments against them.
Here's a common workflow:

1) I write a function fun.
2) I write a function test_fun that tests fun.
3) I run test_fun in isolation (saves time, only need to run that)
4) Later on, once its debugged I turn test_fun into a unittest.

Having unittest(test_fun){...} would simplify this routine.

 
Damn near every codebase in D uses "unittest{}" sections. Obviously
that's good.

But it's also bad:

I cannot flip on unittests for my project (where "I" and "my" can be
substituted with the name of any D user) without *also* flipping on
unittests for every source-library used, transitively. Unless the lib
versions-out their unittests with "version(Unittest_MyLibXXX)"...And
none of them do. (well, mostly)

This *can* be fine, *when*:

- They're all fast.

- Their sum doesn't make DMD's memory usage go kabloom.

- They all have all their prereqs already setup (sometimes the need for
  some configuration isn't easily avoidable, example: setting up a DB
  user/login).

- And none of them have any failures...on the *exact*
  OS/arch/compiler/compiler-version combination that I happen to be
  using. Oh, and the exact versions of any other dependent libs.

We could say "Let's just recommend good style is to version out your
unittest blocks". But that's programming by convention: All it takes is
one lib not playing ball, or one unittest in one lib that just happened
to forget it, and then the poor user is back to "ad-hoc patching"-land.
And it's boiler-plate, anyway.

So alright...Who's with me?!!! "Yeaaaa......!!!!!" (<-- Belushi running
out the door)