diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb index 2e4235fb69..a670c77310 100644 --- a/tool/lib/core_assertions.rb +++ b/tool/lib/core_assertions.rb @@ -24,13 +24,11 @@ module Test end module CoreAssertions + require_relative 'envutil' + if defined?(MiniTest) - require_relative 'envutil' # for ruby core testing include MiniTest::Assertions - - # Compatibility hack for assert_raise - Test::Unit::AssertionFailedError = MiniTest::Assertion else module MiniTest class Assertion < Exception; end @@ -38,7 +36,6 @@ module Test end require 'pp' - require_relative 'envutil' include Test::Unit::Assertions end diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb index c61f296da9..b99fb19adf 100644 --- a/tool/lib/test/unit/assertions.rb +++ b/tool/lib/test/unit/assertions.rb @@ -303,5 +303,9 @@ EOT template.gsub(/\G((?:[^\\]|\\.)*?)(\\)?\?/) { $1 + ($2 ? "?" : mu_pp(arguments.shift)) } end end + + # Compatibility hack for assert_raise + AssertionFailedError = MiniTest::Assertion + end end