www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18131] New: Not possible to unittest package symbol outside

https://issues.dlang.org/show_bug.cgi?id=18131

          Issue ID: 18131
           Summary: Not possible to unittest package symbol outside of
                    package
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: doob me.com

If a symbol is declared with "package" it's not possible to access it inside a
unittest block if the module is not inside a package. Example:

$ cat foo.d
package void bar() {}

unittest
{
    bar();
}

$ dmd -unittest foo.d
foo.d(5): Error: function foo.bar is not accessible from module foo

--
Dec 27 2017