Unit tests in D

Lutger lutger.blijdestijn at gmail.com
Wed May 5 23:08:08 PDT 2010

bearophile wrote:

> Lutger:
>>rdmd has the option --main, together with -unittest you can easily do
> This page doesn't list that option:
> http://www.digitalmars.com/d/2.0/rdmd.html
> rdmd prints:
> --eval=code       evaluate code +� la perl -e (multiple --eval allowed)
> --loop            assume "foreach (line; stdin.byLine()) { ... }" for eval
> --main            add a stub main program to the mix (e.g. for unittesting)
> I don't understand how to use those three switches. Do you know where I can
> find usage examples for those three?

I don't know. This is how you can unittest a single module:

rdmd --main -unittest test.d

it just links in a predefined .d file with a main() routine, that's all.

More information about the Digitalmars-d mailing list