summaryrefslogtreecommitdiff
path: root/tool/lib/core_assertions.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-09-06 22:17:40 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-09-11 08:48:03 +0900
commit1bec4f251d2dbf5578a884a8fb96c773ffa5e451 (patch)
tree6bb136bbf2f418cace8bc89525c4de32ab5236d6 /tool/lib/core_assertions.rb
parentcd829bb078e6a3486d9b5ea57fc5111d289c1860 (diff)
downloadruby-1bec4f251d2dbf5578a884a8fb96c773ffa5e451.tar.gz
Move MiniTest::Assertions to Test::Unit::Assertions
Diffstat (limited to 'tool/lib/core_assertions.rb')
-rw-r--r--tool/lib/core_assertions.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb
index a670c77310..fd3c187191 100644
--- a/tool/lib/core_assertions.rb
+++ b/tool/lib/core_assertions.rb
@@ -26,19 +26,16 @@ module Test
module CoreAssertions
require_relative 'envutil'
- if defined?(MiniTest)
- # for ruby core testing
- include MiniTest::Assertions
- else
+ unless defined?(MiniTest)
module MiniTest
class Assertion < Exception; end
class Skip < Assertion; end
end
-
- require 'pp'
- include Test::Unit::Assertions
end
+ require 'pp'
+ include Test::Unit::Assertions
+
def mu_pp(obj) #:nodoc:
obj.pretty_inspect.chomp
end
@@ -733,6 +730,14 @@ eom
end
alias all_assertions assert_all_assertions
+ def assert_all_assertions_foreach(msg = nil, *keys, &block)
+ all = AllFailures.new
+ all.foreach(*keys, &block)
+ ensure
+ assert(all.pass?, message(msg) {all.message.chomp(".")})
+ end
+ alias all_assertions_foreach assert_all_assertions_foreach
+
def message(msg = nil, *args, &default) # :nodoc:
if Proc === msg
super(nil, *args) do