From d8d9bac5c8b071135e50ad3f21c8a9b6a9c06e54 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 5 Jan 2011 20:14:43 +0000 Subject: * ext/stringio/stringio.c (get_strio, strio_set_string) (strio_reopen): check if frozen. [ruby-core:33648] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/stringio/test_stringio.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/stringio') diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index b7327adced..78718a2d86 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -471,4 +471,13 @@ class TestStringIO < Test::Unit::TestCase expected_pos += 1 end end + + def test_frozen + s = StringIO.new + s.freeze + bug = '[ruby-core:33648]' + assert_raise(RuntimeError, bug) {s.puts("foo")} + assert_raise(RuntimeError, bug) {s.string = "foo"} + assert_raise(RuntimeError, bug) {s.reopen("")} + end end -- cgit v1.2.3