Summary: assert should print the source code for the condition
                    when no message argument present
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Val Markovic <> 2012-10-05 19:59:52 PDT ---
I'd love to see the following:

assert(5 == 4);

print out the actual source code of the condition on failure, that is
"core.exception.AssertError@foo.d(123): 5 == 4". This should happen when there
is no user-defined message (and maybe _in addition to_ the provided message).
Currently I just get "unittest failure" instead of the condition source, which
is useless.

This would make it far, far easier to track down which assert failed without
having to actually go look at the line number in the file. Also, this is what
most unit-testing libraries for other languages do already, like for example
GoogleTest for C++ etc.

Since assert() is not a function but an expression in the language, this should
not be impossible to implement, should it? GoogleTest does it with macros, but
(thank God) we don't have those in D.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to