From 77f987376cb2489807c23e5192bae69b233acdea Mon Sep 17 00:00:00 2001 From: kazu Date: Tue, 22 Apr 2008 15:23:01 +0000 Subject: * test/ruby/test_symbol.rb (TestSymbol#test_to_proc): Improve tests of Symbol#to_proc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_symbol.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test') 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 -- cgit v1.2.3