Sometimes it's useful to have an introductory example for a module, but documented unittest currently don't work for that. cat > mod.d << CODE /** My Module */ module mod; /// unittest { auto example = "usage"; } CODE dmd -D -c -o- mod Should produce the same output as this. cat > mod.d << CODE /** My Module ---- auto example = "usage"; ---- */ module mod; CODE
Just hit this problem as well while documenting std.allocator, and found this as I was submitting.
I got sick of waiting for somebody to fix this, so I did it myself: https://github.com/D-Programming-Language/dmd/pull/5465
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ee69cc59c06587a39c7f7603a30ab8a5d0fa2e4e Fix issue 14383: attach ddoc unittests to module declaration Turns out that the ddoc code already handles generating docs for module unittests; all that was missing was that the parser wasn't attaching these unittests to the module declaration. https://github.com/D-Programming-Language/dmd/commit/17ae1b37c42a1abed81cce68bcb6c0957e486e5a Merge pull request #5465 from quickfur/issue14383 Issue 14383: attach ddoc unittests to module declaration