1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Simplify conditions for CoreAssertion initialization

This commit is contained in:
Hiroshi SHIBATA 2021-09-06 19:31:24 +09:00
parent 940a19e4b3
commit 544e37f184
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 6 additions and 5 deletions

View file

@ -24,13 +24,11 @@ module Test
end
module CoreAssertions
if defined?(MiniTest)
require_relative 'envutil'
if defined?(MiniTest)
# 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

View file

@ -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