https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112010-11-07T20:14:06ZRuby Issue Tracking SystemRuby master - Feature #4025: Add Assertion class to Corehttps://bugs.ruby-lang.org/issues/4025?journal_id=140812010-11-07T20:14:06Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>=begin<br>
This feature needs at least consensus among test frame work authors.<br>
And it needs more use cases.<br>
Your proposal prevents to define Assertion class it inherits other than Exception class.<br>
=end</p> Ruby master - Feature #4025: Add Assertion class to Corehttps://bugs.ruby-lang.org/issues/4025?journal_id=176012011-06-08T21:19:40Ztrans (Thomas Sawyer)
<ul></ul><p>Pretty sure Assertion has to be subclass of Exception, because the way test runners work is to use #rescue to catch Assertion failure and other exceptions. Test framework developers can still subclass it for their own specific purposes, e.g. original TestUnit library could do:</p>
<pre><code>module Test
module Unit
class Failure < Assertion
</code></pre>
<p>An alternative is to define methods Exception#assertion? and Exception#set_assertion(boolean). Then test framework developers can use that to differentiate assertions from other errors.</p>