diff options
Diffstat (limited to 'test/ruby/test_refinement.rb')
-rw-r--r-- | test/ruby/test_refinement.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 4a0e6d1327..eee66105b1 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -622,4 +622,28 @@ class TestRefinement < Test::Unit::TestCase def test_symbol_to_proc assert_equal("foo", SymbolToProc::M.call_foo) end + + module Inspect + module M + refine Fixnum do + end + end + end + + def test_inspect + assert_equal("#<refinement:Fixnum@TestRefinement::Inspect::M>", + Inspect::M.refinements[Fixnum].inspect) + + c = Class.new + m = Module.new { + refine String do + end + refine c do + end + } + assert_equal("#<refinement:String@#{m.inspect}>", + m.refinements[String].inspect) + assert_equal("#<refinement:#{c.inspect}@#{m.inspect}>", + m.refinements[c].inspect) + end end |