http://d.puremagic.com/issues/show_bug.cgi?id=9625
Summary: assertNotThrown should print exception msg if no msg
is provided
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 2013-03-01
12:33:17 PST ---
Note the implementation:
void assertNotThrown(T : Throwable = Exception, E)
(lazy E expression,
string msg = null,
string file = __FILE__,
size_t line = __LINE__)
{
try
expression();
catch(T t)
{
immutable tail = msg.empty ? "." : ": " ~ msg;
throw new AssertError(format("assertNotThrown failed: %s was thrown%s",
T.stringof,
tail),
file,
line,
t);
}
}
Specifically this line:
immutable tail = msg.empty ? "." : ": " ~ msg;
This should rather be:
immutable tail = ": " msg.empty ? t.msg : msg;
That way you get back the exception message if you haven't provided your own.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------