summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-12 15:54:50 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-12 15:54:50 +0000
commit3041c43df15bd895c41860930332579b80f7d68e (patch)
treeaaf0cfff494ec6559b4be52aa4dba392f417483a /test
parentba76a79a3eeba71cc3d6ea952521e42415b025a6 (diff)
merge revision(s) 42869: [Backport #8872]
* vm_eval.c (vm_call0): fix prototype, the id parameter should be of type ID, not VALUE * vm_insnhelper.c (check_match): the rb_funcall family of functions does not care about refinements. We need to use rb_method_entry_with_refinements instead to call === with refinements. Thanks to Jon Conley for reporting this bug. [ruby-core:57051] [Bug #8872] * test/ruby/test_refinement.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_refinement.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 23b73667a7..b6bdc9430f 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -826,6 +826,27 @@ class TestRefinement < Test::Unit::TestCase
assert_equal([:foo, :ref, bug7925], x, bug7925)
end
+ def test_case_dispatch_is_aware_of_refinements
+ assert_in_out_err([], <<-RUBY, ["refinement used"], ["-:2: warning: Refinements are experimental, and the behavior may change in future versions of Ruby!"])
+ module RefineSymbol
+ refine Symbol do
+ def ===(other)
+ true
+ end
+ end
+ end
+
+ using RefineSymbol
+
+ case :a
+ when :b
+ puts "refinement used"
+ else
+ puts "refinement not used"
+ end
+ RUBY
+ end
+
private
def eval_using(mod, s)