summaryrefslogtreecommitdiff
path: root/test/ruby/test_refinement.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2022-05-27 13:47:06 -0700
committerJohn Hawthorn <[email protected]>2022-06-16 13:24:48 -0700
commitae163cae6b3f01e0fb827e0a18d5889f9703617f ()
tree72d4c7c8545d6e6459a099336c196012a762b6eb /test/ruby/test_refinement.rb
parentcd5cafa4a380e2459862b6e99ff0c381362ef1be (diff)
Allow calling protected methods from refinements
Previously protected methods on refinements could never be called because they were seen as being "defined" on the hidden refinement ICLASS. This commit updates calling refined protected methods so that they are considered to be defined on the original class (the one being refined). This ended up using the same behaviour that was used to check whether a call to super was allowed, so I extracted that into a method. [Bug #18806]
Notes: Merged: https://.com/ruby/ruby/pull/5966
-rw-r--r--test/ruby/test_refinement.rb35
1 files changed, 35 insertions, 0 deletions
@@ -1206,6 +1206,41 @@ class TestRefinement < Test::Unit::TestCase
INPUT
end
def test_refine_basic_object
assert_separately([], <<-"end;")
bug10106 = '[ruby-core:64166] [Bug #10106]'