Thread overview
[Issue 11133] ddoc: documented unittest outside of version scope
Dec 14, 2017
Jonathan M Davis
Dec 14, 2017
Jonathan M Davis
Dec 14, 2017
Jonathan M Davis
Dec 17, 2022
Iain Buclaw
December 14, 2017
https://issues.dlang.org/show_bug.cgi?id=11133

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang@jmdavisProg.co
                   |                            |m

--- Comment #2 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
Similarly, the unit tests don't end up in the docs in this code, and version(D_Ddoc) isn't even involved:

==============
///
struct S
{
    /// Something about foo.
    version(Posix)
        alias Foo = int;
    else version(Windows)
        alias Foo = int;

    ///
    unittest
    {
        Foo foo;
    }
}
==============

Or at least, the unit test doesn't show up in the docs if you compile on a POSIX system. I assume that it will show up if you compile on Windows, since if I flip the versions, the unit test does show up. So, I guess that it considers the unit test to go with the symbol in the else block and will only put the test in the docs if  it's the last version that's taken.

I have a similar problem in my code with static ifs, so I think that this problem applies to them too.

--
December 14, 2017
https://issues.dlang.org/show_bug.cgi?id=11133

--- Comment #3 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
Here's an example that has the problem with static if:

///
struct S(R)
{
    /// Some docs
    static if(is(R == string))
        alias S = R;
    else
        alias S = int;

    ///
    unittest
    {
        S s;
    }
}

--
December 14, 2017
https://issues.dlang.org/show_bug.cgi?id=11133

--- Comment #4 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
Related: https://issues.dlang.org/show_bug.cgi?id=18077

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=11133

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--