Bug 9474 – Ddoc'd unittests should work correctly with interspersed version(none)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-07T15:35:00Z
Last change time
2013-03-22T18:21:07Z
Keywords
ddoc, pull
Assigned to
nobody
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2013-02-07T15:35:25Z
Code: ---------- /** * Documented function */ void documentedFunction() { doSomething(); } /// Documented unittest unittest { ... } /// ditto void documentedFunction(int a) { // This is an overload of the no-args documentedFunction. } -------------- Currently, the ddoc for the unittest will fail to appear. Removing the ditto comment makes the problem go away. Ideally, this needs to do the Right Thing (the unittest should appear in the Example section in the ditto'd docs).
Comment #1 by andrej.mitrovich — 2013-02-07T15:43:48Z
I'm not sure what you mean exactly. When I test this: /** * Documented function */ void documentedFunction() { } /// Documented unittest unittest { documentedFunction(); } /// ditto void documentedFunction(int a) { // This is an overload of the no-args documentedFunction. } $ dmd -D -o- test.d The output I get is: void documentedFunction(); void documentedFunction(int a); Documented function Example: documentedFunction(); What should the output be?
Comment #2 by hsteoh — 2013-02-07T15:49:24Z
Hmm, I may need to reduce my actual failing test case, then. I thought it was just because of the /// ditto, but seems it may be something else.
Comment #3 by hsteoh — 2013-02-07T16:01:10Z
OK, found the real cause of failure: -------------------- /** * Documentation */ void func() {} version(none) unittest { ... } /// Example unittest { ... } --------------------- Removing the version line makes the problem go away. Note that ditto works when placed after the version line, so IMO the unittest ddocs should, too.
Comment #4 by andrej.mitrovich — 2013-02-08T10:01:34Z
Comment #5 by hsteoh — 2013-02-16T21:38:19Z
Possibly related to bug 9524.
Comment #6 by andrej.mitrovich — 2013-03-20T14:10:50Z
Comment #7 by github-bugzilla — 2013-03-22T18:19:35Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c74a85802ccb7b39a1ae783480af9d658e2e13be fix Issue 9474 - Ddoc'd unittests should work correctly with interspersed version(none) https://github.com/D-Programming-Language/dmd/commit/65b882c81e56c0c8e2e8f802778611ce6503e2bc Merge pull request #1773 from 9rnsr/fix9474 Issue 9474 - Ddoc'd unittests should work correctly with interspersed version(none)