www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9474] New: Ddoc's unittests should work correctly with ditto

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474

           Summary: Ddoc's unittests should work correctly with ditto
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: hsteoh quickfur.ath.cx


--- Comment #0 from hsteoh quickfur.ath.cx 2013-02-07 15:35:25 PST ---
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).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 07 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-07
15:43:48 PST ---
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?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 07 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474



--- Comment #2 from hsteoh quickfur.ath.cx 2013-02-07 15:49:24 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 07 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474



--- Comment #3 from hsteoh quickfur.ath.cx 2013-02-07 16:01:10 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 07 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ddoc, pull
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-08
10:01:34 PST ---
https://github.com/D-Programming-Language/dmd/pull/1646

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474



--- Comment #5 from hsteoh quickfur.ath.cx 2013-02-16 21:38:19 PST ---
Possibly related to bug 9524.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|andrej.mitrovich gmail.com  |nobody puremagic.com


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-03-20
14:10:50 PDT ---
New pull by Kenji: https://github.com/D-Programming-Language/dmd/pull/1773

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 20 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474



--- Comment #7 from github-bugzilla puremagic.com 2013-03-22 18:19:35 PDT ---
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)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 22 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9474


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 22 2013