Add Assertion class to Core
I notice every test framework has it's own Assertion class (names very such as AssertionFailure, AssertionFailureError, etc.)
It would help interoperability if Ruby had a base exception they all could depend upon. Essentially:
class Assertion < Exception; end
This comes from MiniTest, just taken out of the MiniTest namespace.
Having a common base class would allow developers to more easily write test utility libraries that could be used by a variety of test frameworks.
Updated by trans (Thomas Sawyer) almost 9 years ago
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:
module Test module Unit class Failure < Assertion
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.