summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-29 12:06:42 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-29 12:06:42 +0000
commit075752a83693aad6d9f8c42783b204df6b8bf332 (patch)
tree9cb766c4932e00f5118ad874e7c186a612b1a9f7 /test
parent8cb0de91c4b00a0615d1bef672b17154495f0a0f (diff)
Add a frozenness check to Enumerator::Generator#initialize.
* enumerator.c (generator_init): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_enumerator.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 07f10dd0415..e3270f3d6ad 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -419,6 +419,11 @@ class TestEnumerator < Test::Unit::TestCase
a = []
assert_equal(:foo, g2.each {|x| a << x })
assert_equal([1, 2, 3], a)
+
+ g.freeze
+ assert_raise(RuntimeError) {
+ g.__send__ :initialize, proc { |y| y << 4 << 5 }
+ }
end
def test_generator_args