summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-07 06:44:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-07 06:44:46 +0000
commitcfa0035962f7c373ca612be5bee749803368fd5b (patch)
tree3b040a18394f2e81079d356f76c5a136b6986fcd /test/-ext-
parentf4ca906d5c3267c0f84db4c5780829783c71a8b6 (diff)
* encoding.c (rb_enc_set_index, rb_enc_associate_index): should
check if frozen. * parse.y (rb_intern3), ruby.c (process_options, ruby_script): defer freezing after associating encodings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-')
-rw-r--r--test/-ext-/string/test_enc_associate.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/-ext-/string/test_enc_associate.rb b/test/-ext-/string/test_enc_associate.rb
new file mode 100644
index 0000000000..edddfb4316
--- /dev/null
+++ b/test/-ext-/string/test_enc_associate.rb
@@ -0,0 +1,12 @@
+require 'test/unit'
+require "-test-/string/string"
+
+class Test_StrEncAssociate < Test::Unit::TestCase
+ def test_frozen
+ s = Bug::String.new("abc")
+ s.force_encoding(Encoding::US_ASCII)
+ s.freeze
+ assert_raise(RuntimeError) {s.associate_encoding!(Encoding::US_ASCII)}
+ assert_raise(RuntimeError) {s.associate_encoding!(Encoding::UTF_8)}
+ end
+end