diff options
Diffstat (limited to 'test/ruby/test_symbol.rb')
-rw-r--r-- | test/ruby/test_symbol.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index 2ccfe64c92..42350ba6e7 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -74,4 +74,19 @@ class TestSymbol < Test::Unit::TestCase assert_inspect_evaled(':$0') assert_inspect_evaled(':$1') end + + def test_to_proc + assert_equal %w(1 2 3), (1..3).map(&:to_s) + [ + [], + [1], + [1, 2], + [1, [2, 3]], + ].each do |ary| + ary_id = ary.object_id + assert_equal ary_id, :object_id.to_proc.call(ary) + ary_ids = ary.collect{|x| x.object_id } + assert_equal ary_ids, ary.collect(&:object_id) + end + end end |