aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-07 16:15:45 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-07 16:15:45 +0000
commitaf654b835c062009ab1175cf86fdad02d6498b98 (patch)
tree63366f8cd8af5234df80982933c574af1f376326 /test
parent86a6dc2ca9f573395545823889521fc168a828e3 (diff)
downloadruby-af654b835c062009ab1175cf86fdad02d6498b98.tar.gz
* eval.c (rb_mod_s_used_refinements): new method
Module.used_refinements. based on the patch by Charlie Somerville. [Feature #7418] [ruby-core:49805] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_refinement.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index c9de8e83e5..1a82ad8373 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1624,6 +1624,55 @@ class TestRefinement < Test::Unit::TestCase
MethodMissing.call_undefined_method
end
end
+
+ module VisibleRefinements
+ module RefA
+ refine Object do
+ def in_ref_a
+ end
+ end
+ end
+
+ module RefB
+ refine Object do
+ def in_ref_b
+ end
+ end
+ end
+
+ module RefC
+ using RefA
+
+ refine Object do
+ def in_ref_c
+ end
+ end
+ end
+
+ module Foo
+ using RefB
+ USED_REFS = Module.used_refinements
+ end
+
+ module Bar
+ using RefC
+ USED_REFS = Module.used_refinements
+ end
+
+ module Combined
+ using RefA
+ using RefB
+ USED_REFS = Module.used_refinements
+ end
+ end
+
+ def test_used_refinements
+ ref = VisibleRefinements
+ assert_equal [], Module.used_refinements
+ assert_equal [ref::RefB], ref::Foo::USED_REFS
+ assert_equal [ref::RefC], ref::Bar::USED_REFS
+ assert_equal [ref::RefB, ref::RefA], ref::Combined::USED_REFS
+ end
private