www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23142] New: Scope should not apply to unittests


          Issue ID: 23142
           Summary: Scope should not apply to unittests
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: alphaglosined gmail.com

When declaring in a class or struct a unittest block should ignore any scope
attributes set due to not having a context pointer.

void main()

struct Foo
    int x;

    void func()


onlineapp.d(9): Error: function `onlineapp.Foo.__unittest_L9_C4` functions
cannot be `scope`

This error is not at all helpful and prevents a common use case for unittests
as documentation without writing scope on every method which is very

May 26 2022