summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_symbol.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index 4d29d96f51..42350ba6e7 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -77,9 +77,16 @@ class TestSymbol < Test::Unit::TestCase
def test_to_proc
assert_equal %w(1 2 3), (1..3).map(&:to_s)
- assert_nothing_raised(ArgumentError) { :object_id.to_proc.call([]) }
- assert_nothing_raised(ArgumentError) { :object_id.to_proc.call([1]) }
- assert_nothing_raised(ArgumentError) { :object_id.to_proc.call([1,2]) }
- assert_nothing_raised(ArgumentError) { :object_id.to_proc.call([1,[2,3]]) }
+ [
+ [],
+ [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