ruby-changes:64334
From: Yusuke <ko1@a...>
Date: Sat, 19 Dec 2020 19:51:09 +0900 (JST)
Subject: [ruby-changes:64334] 1ba8d63b49 (master): Recommit 34f06062174882a98ebef998c50ad8d4f7fc0f2e
https://git.ruby-lang.org/ruby.git/commit/?id=1ba8d63b49 From 1ba8d63b49318e5682a22502c5f5b70e3298da8f Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Sat, 19 Dec 2020 18:22:44 +0900 Subject: Recommit 34f06062174882a98ebef998c50ad8d4f7fc0f2e diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index cb8631b..443ccc3 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -840,6 +840,11 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L840 assert_equal(:aClass1, o.aClass1) assert_equal(:aClass2, o.aClass2) + o = (c = Class.new(AClass)).new + c.class_eval {public [:aClass1, :aClass2]} + assert_equal(:aClass1, o.aClass1) + assert_equal(:aClass2, o.aClass2) + o = AClass.new assert_equal(:aClass, o.aClass) assert_raise(NoMethodError, /private method/) {o.aClass1} @@ -857,6 +862,11 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L862 assert_raise(NoMethodError, /private method/) {o.aClass} assert_raise(NoMethodError, /private method/) {o.aClass2} + o = (c = Class.new(AClass)).new + c.class_eval {private [:aClass, :aClass2]} + assert_raise(NoMethodError, /private method/) {o.aClass} + assert_raise(NoMethodError, /private method/) {o.aClass2} + o = AClass.new assert_equal(:aClass, o.aClass) assert_raise(NoMethodError, /private method/) {o.aClass1} @@ -883,6 +893,13 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L893 assert_equal(:aClass, c.new._aClass(o)) assert_equal(:aClass1, c.new._aClass1(o)) + o = (c = Class.new(aclass)).new + c.class_eval {protected [:aClass, :aClass1]} + assert_raise(NoMethodError, /protected method/) {o.aClass} + assert_raise(NoMethodError, /protected method/) {o.aClass1} + assert_equal(:aClass, c.new._aClass(o)) + assert_equal(:aClass1, c.new._aClass1(o)) + o = AClass.new assert_equal(:aClass, o.aClass) assert_raise(NoMethodError, /private method/) {o.aClass1} -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/