diff options
author | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-22 15:23:01 +0000 |
---|---|---|
committer | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-22 15:23:01 +0000 |
commit | 77f987376cb2489807c23e5192bae69b233acdea (patch) | |
tree | 42677c040988b87b23d04a147f0d6e8591e8b97a /test | |
parent | 4bf25bbe203c42d0108a5d0aa66a84daa5b87367 (diff) | |
download | ruby-77f987376cb2489807c23e5192bae69b233acdea.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_symbol.rb | 15 |
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 |