[前][次][番号順一覧][スレッド一覧]

ruby-changes:60584

From: Hiroshi <ko1@a...>
Date: Mon, 30 Mar 2020 21:33:25 +0900 (JST)
Subject: [ruby-changes:60584] e5db3da9d3 (master): Migrate {assert, refute}_patch_exits for compatibility with Minitest5

https://git.ruby-lang.org/ruby.git/commit/?id=e5db3da9d3

From e5db3da9d34f0a7595208863301c044b612adbed Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Mon, 30 Mar 2020 21:32:26 +0900
Subject: Migrate {assert,refute}_patch_exits for compatibility with Minitest5


diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 3c00a49..e56150c 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -127,12 +127,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L127
     assert_equal expected.sort, loaded.sort if expected
   end
 
-  # TODO: move to minitest
-  def assert_path_exists(path, msg = nil)
-    msg = message(msg) { "Expected path '#{path}' to exist" }
-    assert File.exist?(path), msg
-  end
-
   def assert_directory_exists(path, msg = nil)
     msg = message(msg) { "Expected path '#{path}' to be a directory" }
     assert_path_exists path
@@ -226,12 +220,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L220
     end
   end
 
-  # TODO: move to minitest
-  def refute_path_exists(path, msg = nil)
-    msg = message(msg) { "Expected path '#{path}' to not exist" }
-    refute File.exist?(path), msg
-  end
-
   def scan_make_command_lines(output)
     output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
   end
diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb
index 3d1b796..c85b41e 100644
--- a/tool/lib/minitest/unit.rb
+++ b/tool/lib/minitest/unit.rb
@@ -446,6 +446,16 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/tool/lib/minitest/unit.rb#L446
       assert caught, message(msg) { default }
     end
 
+    def assert_path_exists(path, msg = nil)
+      msg = message(msg) { "Expected path '#{path}' to exist" }
+      assert File.exist?(path), msg
+    end
+
+    def refute_path_exists(path, msg = nil)
+      msg = message(msg) { "Expected path '#{path}' to not exist" }
+      refute File.exist?(path), msg
+    end
+
     ##
     # Captures $stdout and $stderr into strings:
     #
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]