1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-10-15 22:59:39 +00:00
parent 9ffaf1405b
commit 9ec940a4c9
2 changed files with 8 additions and 12 deletions

View file

@ -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)

View file

@ -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