aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_array.rb7
-rw-r--r--test/ruby/test_enum.rb5
2 files changed, 9 insertions, 3 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 04ed13892b..1cd018be85 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1505,8 +1505,11 @@ class TestArray < Test::Unit::TestCase
ary = Object.new
def ary.to_a; [1, 2]; end
- def ary.to_ary; [3, 4]; end
- assert_equal([[5, 3], [6, 4]], [5, 6].zip(ary))
+ assert_raise(NoMethodError){ %w(a b).zip(ary) }
+ def ary.each; [3, 4].each{|e|yield e}; end
+ assert_equal([['a', 3], ['b', 4]], %w(a b).zip(ary))
+ def ary.to_ary; [5, 6]; end
+ assert_equal([['a', 5], ['b', 6]], %w(a b).zip(ary))
end
def test_transpose
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index 973b7cb420..a8a88640bd 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -214,8 +214,11 @@ class TestEnumerable < Test::Unit::TestCase
ary = Object.new
def ary.to_a; [1, 2]; end
- def ary.to_ary; [3, 4]; end
+ assert_raise(NoMethodError){ %w(a b).zip(ary) }
+ def ary.each; [3, 4].each{|e|yield e}; end
assert_equal([[1, 3], [2, 4], [3, nil], [1, nil], [2, nil]], @obj.zip(ary))
+ def ary.to_ary; [5, 6]; end
+ assert_equal([[1, 5], [2, 6], [3, nil], [1, nil], [2, nil]], @obj.zip(ary))
end
def test_take