http://d.puremagic.com/issues/show_bug.cgi?id=10026
Summary: Allow to assert that exception must be thrown
Product: D
Version: future
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: druntime
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Pasha S <[email protected]> 2013-05-03 18:55:02 PDT ---
I'd like to suggest that existing syntax for assert() keyword was enhanced in
order to allow detection of exception thrown by the expression provided. It may
look like this:
assert!(DivisionByZero)( powermod(2, 1000, 0) );
assert!(InvalidArgument)( fastsqrt(-42) );
(or it may look otherwise, I'm not really an expert in language syntax).
The reason for such functionality to exist is that "assert" is used for
unit-testing of a class or module. Correct handling of errors is part of the
specification of any non-trivial class, and the "D way" to handle errors is by
throwing exceptions. Which current assert cannot test.
What do you think?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------