From 9ec940a4c9ca01d9010f657b60d7336cd3c4161c Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 15 Oct 2016 22:59:39 +0000 Subject: test_refinement.rb: test_symbol_proc * test/ruby/test_refinement.rb (test_symbol_proc): move from test_symbol.rb [Feature #9451] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_refinement.rb | 8 ++++++++ test/ruby/test_symbol.rb | 12 ------------ 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index a53fe2b522..2ecbf8edf0 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -74,6 +74,10 @@ class TestRefinement < Test::Unit::TestCase using TestRefinement::FooExt begin + def self.map_x_on(foo) + [foo].map(&:x)[0] + end + def self.invoke_x_on(foo) return foo.x end @@ -1737,6 +1741,10 @@ class TestRefinement < Test::Unit::TestCase INPUT end + def test_symbol_proc + assert_equal("FooExt#x", FooExtClient.map_x_on(Foo.new)) + end + private def eval_using(mod, s) diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index a135338edb..d8c91c1eea 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -435,16 +435,4 @@ class TestSymbol < Test::Unit::TestCase assert_equal str, str.to_sym.to_s assert_not_predicate(str, :frozen?, bug11721) end - - module WithRefinements - using Module.new {refine(Integer) {alias inc succ}} - def mapinc(a) - a.map(&:inc) - end - end - - def test_proc_with_refinements - obj = Object.new.extend WithRefinements - assert_equal [*1..3], obj.mapinc(0..2) - end end -- cgit v1.2.3