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

ruby-changes:59862

From: Koichi <ko1@a...>
Date: Wed, 29 Jan 2020 01:01:14 +0900 (JST)
Subject: [ruby-changes:59862] 7882c43fc3 (master): refactoring: use Proc and Constant.

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

From 7882c43fc306c1100be8e1648f3d1caa48d50a8a Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Wed, 29 Jan 2020 00:49:53 +0900
Subject: refactoring: use Proc and Constant.


diff --git a/test/ruby/test_const.rb b/test/ruby/test_const.rb
index 51637a2..f6b9ea8 100644
--- a/test/ruby/test_const.rb
+++ b/test/ruby/test_const.rb
@@ -4,7 +4,7 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/test/ruby/test_const.rb#L4
 
 class TestConst < Test::Unit::TestCase
 
-  setup_constants_proc = -> do
+  Constants_Setup = -> do
     remove_const :TEST1  if defined? ::TestConst::TEST1
     remove_const :TEST2  if defined? ::TestConst::TEST2
     remove_const :Const  if defined? ::TestConst::Const
@@ -24,12 +24,9 @@ class TestConst < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_const.rb#L24
     end
   end
 
-  define_method :setup_constants do
-    setup_constants_proc.call
-  end
-
   def test_const
-    setup_constants
+    Constants_Setup.call
+
     assert defined?(TEST1)
     assert_equal 1, TEST1
     assert defined?(TEST2)
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index dd163e1..563011a 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1108,7 +1108,7 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L1108
     assert_equal([:bar, :foo], b.local_variables.sort, bug11012)
   end
 
-  setup_for_test_method_in_method_visibility_should_be_public_proc = -> do
+  MethodInMethodClass_Setup = -> do
     remove_const :MethodInMethodClass if defined? MethodInMethodClass
 
     class MethodInMethodClass
@@ -1121,12 +1121,8 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L1121
     end
   end
 
-  define_method :setup_for_test_method_in_method_visibility_should_be_public do
-    setup_for_test_method_in_method_visibility_should_be_public_proc.call
-  end
-
   def test_method_in_method_visibility_should_be_public
-    setup_for_test_method_in_method_visibility_should_be_public
+    MethodInMethodClass_Setup.call
 
     assert_equal([:m1].sort, MethodInMethodClass.public_instance_methods(false).sort)
     assert_equal([].sort, MethodInMethodClass.private_instance_methods(false).sort)
-- 
cgit v0.10.2


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

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