On 5/14/16, H. S. Teoh via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > I like this idea. But wouldn't it be too verbose?
Hmm good point. Alternatively we could perhaps make ddoc inject writeln calls, something like: ---- auto sum (a, b) => a + b; /// unittest { assert(sum(2, 2) == 4); } ---- Turns into ddoc output: ---- writeln(sum(2, 2)); assert(sum(2, 2) == 4); ---- > How would the assert implementation in druntime access the expression > being tested? I.e., in a way that it can be printed out in > human-readable form. Ah I was remembering wrong here. The compiler turns the assert expression into something like "cast(bool)expression || __assert". So anyway, I think perhaps the simplest solution is to make ddoc inject the writeln calls (or possibly replace assertions altogether in the output).