summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-29 12:20:19 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-29 12:20:19 +0000
commit952e444877f53492ba0c8ddae7a1fe413b536ec1 (patch)
tree35b03f52d21e3051e66cca20d0ed545e948d5040 /test
parentf2f18dab7c038ddbef4cb2afe75f0e4f69320f19 (diff)
Add a frozenness check test for Enumerator::Lazy#initialize.
* test/ruby/test_lazy_enumerator.rb (TestLazyEnumerator#test_initialize): Make sure Enumerator::Lazy#initialize raises error if the object is frozen. The check was performed by rb_ivar_set() before rb_check_frozen() was added to enumerator_init(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_lazy_enumerator.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb
index 94b16a2841d..1108b937069 100644
--- a/test/ruby/test_lazy_enumerator.rb
+++ b/test/ruby/test_lazy_enumerator.rb
@@ -22,6 +22,12 @@ class TestLazyEnumerator < Test::Unit::TestCase
assert_equal([1, 2, 3], [1, 2, 3].lazy.to_a)
assert_equal([1, 2, 3], Enumerator::Lazy.new([1, 2, 3]){|y, v| y << v}.to_a)
assert_raise(ArgumentError) { Enumerator::Lazy.new([1, 2, 3]) }
+
+ a = [1, 2, 3].lazy
+ a.freeze
+ assert_raise(RuntimeError) {
+ a.__send__ :initialize, [4, 5], &->(y, *v) { y << yield(*v) }
+ }
end
def test_each_args