D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14383 - [ddoc] documented unittests don't work for module declaration
Summary: [ddoc] documented unittests don't work for module declaration
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: ddoc, pull
Depends on:
Blocks:
 
Reported: 2015-03-31 17:01 UTC by Martin Nowak
Modified: 2016-02-23 04:20 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2015-03-31 17:01:51 UTC
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
Comment 1 Andrei Alexandrescu 2015-05-07 18:48:00 UTC
Just hit this problem as well while documenting std.allocator, and found this as I was submitting.
Comment 2 hsteoh 2016-02-17 23:17:57 UTC
I got sick of waiting for somebody to fix this, so I did it myself:

https://github.com/D-Programming-Language/dmd/pull/5465
Comment 3 github-bugzilla 2016-02-23 04:20:44 UTC
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