www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11133] New: ddoc: documented unittest outside of version scope

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

           Summary: ddoc: documented unittest outside of version scope
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu


--- Comment #0 from Martin Nowak <code dawg.eu> 2013-09-27 19:53:05 PDT ---
I have the following case where I want to split implementations and
documentation. The following unittest should also be used as example in the
docs but that doesn't work.

version (D_Ddoc)
{
    /// Library docs
    struct Library
    {
        /// foo
        void foo();
    }

    // unittests docs only work here, but here they don't run
}
else version (Windows)
{
    // Library impls
    struct Library
    {
        void foo() {}
    }
}
else version (Posix)
{
    // Library impls
    struct Library
    {
        void foo() {}
    }
}

///
unittest
{
    // shared unittest used as example and for testing
    Library lib;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 27 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11133



--- Comment #1 from Martin Nowak <code dawg.eu> 2013-09-27 20:00:32 PDT ---
Ah I forgot to mention. The following case works. It seems like it's the else
branch that break the unittest docs.

version (D_Ddoc)
{
  ///
  struct Library {}
}

///
version (all) unittest
{
}

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