summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_enum.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 3b0e0f79b2..b6d96f1379 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -394,6 +394,17 @@ class TestEnumerable < Test::Unit::TestCase
def test_tally
h = {1 => 2, 2 => 2, 3 => 1}
assert_equal(h, @obj.tally)
+
+ h = {1 => 5, 2 => 2, 3 => 1, 4 => "x"}
+ assert_equal(h, @obj.tally({1 => 3, 4 => "x"}))
+
+ assert_raise(TypeError) do
+ @obj.tally({1 => ""})
+ end
+
+ h = {1 => 2, 2 => 2, 3 => 1}
+ assert_equal(h, @obj.tally(Hash.new(100)))
+ assert_equal(h, @obj.tally(Hash.new {100}))
end
def test_first