summaryrefslogtreecommitdiff
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-28 02:40:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-28 02:40:46 +0000
commit4191a6b90d3eeb63a31609dba29a1904efee3738 (patch)
tree6689e8d252ca17f1f90626d7ade4b144dbfccdd7 /test/ruby/test_enumerator.rb
parent7d49923e9e9a9d1a01f3183fd798258e9d289da0 (diff)
preserve encodings in error messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index b5ced3b..91c91a4 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -433,6 +433,18 @@ class TestEnumerator < Test::Unit::TestCase
assert_raise(RuntimeError) {
g.__send__ :initialize, proc { |y| y << 4 << 5 }
}
+
+ g = Enumerator::Generator.new(proc {|y| y << 4 << 5; :foo })
+ a = []
+ assert_equal(:foo, g.each {|x| a << x })
+ assert_equal([4, 5], a)
+
+ assert_raise(LocalJumpError) {Enumerator::Generator.new}
+ assert_raise(TypeError) {Enumerator::Generator.new(1)}
+ obj = eval("class C\u{1f5ff}; self; end").new
+ assert_raise_with_message(TypeError, /C\u{1f5ff}/) {
+ Enumerator::Generator.new(obj)
+ }
end
def test_generator_args