www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13746] New: formatValue of functions and delegates with UDA

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

          Issue ID: 13746
           Summary: formatValue of functions and delegates with UDA or
                     nogc
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: ilyayaroshenko gmail.com

unittest
{
    static void func() {}
    formatTest( &func, "void function()" );
}

unittest
{
    void func()  nogc {}
    formatTest( &func, " nogc void delegate()" );
}

void formatTest(T)(T val, string expected, size_t ln = __LINE__, string fn =
__FILE__)
{
    import std.array : appender;
    import std.conv : text;
    FormatSpec!char f;
    auto w = appender!string();
    formatValue(w, val, f);
    enforce!AssertError(
            w.data == expected,
            text("expected = `", expected, "`, result = `", w.data, "`"), fn,
ln);
}

--
Nov 18 2014