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 | 585e3d7772c7282559e528c1c8e7622d2809e632 (patch) | |
| tree | 42677c040988b87b23d04a147f0d6e8591e8b97a /test/ruby | |
| parent | 416e91e4708f5086f5959b6cad73e2fb365f839e (diff) | |
| download | ruby-585e3d7772c7282559e528c1c8e7622d2809e632.tar.gz ruby-585e3d7772c7282559e528c1c8e7622d2809e632.tar.xz ruby-585e3d7772c7282559e528c1c8e7622d2809e632.zip | |
* test/ruby/test_symbol.rb (TestSymbol#test_to_proc): Improve tests of Symbol#to_proc.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -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 4d29d96f5..42350ba6e 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 |
