diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-18 15:02:36 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-18 15:02:36 +0000 |
commit | 8480bcc8d5c72b61055cfa98e80f37fd62ae7ad4 (patch) | |
tree | f404254dbcee2a59866dbb3f7baab4df8e4b23ce /test/ruby | |
parent | 32378c5abea38a8278dae28eae9abcd547ac8a95 (diff) |
Merge -r16241:16456 from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_array.rb | 8 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 3cb1ec174e..6a816a2c85 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -528,6 +528,14 @@ class TestArray < Test::Unit::TestCase assert_equal([1, 2, 3, 1, 2, 3], a) end + def test_count + a = @cls[1, 2, 3, 1, 2] + assert_equal(2, a.count(1)) + assert_equal(3, a.count {|x| x % 2 == 1 }) + assert_equal(2, a.count(1) {|x| x % 2 == 1 }) + assert_raise(ArgumentError) { a.count(0, 1) } + end + def test_delete a = @cls[*('cab'..'cat').to_a] assert_equal('cap', a.delete('cap')) diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index b22c2cba62..d721176aa0 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -47,5 +47,7 @@ class TestMethod < Test::Unit::TestCase assert_equal(o, m.receiver) assert_equal("foo", m.name) assert_equal(class << o; self; end, m.owner) + assert_equal("foo", m.unbind.name) + assert_equal(class << o; self; end, m.unbind.owner) end end |