summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-13 09:34:49 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-13 12:46:48 +0900
commitfce667ed08f25fa7ce43c9b07be170f341a04c4e (patch)
tree56afed76806c5c6793040de5c00f7acc72c30a59 /test/ruby
parentb1b155ff03634ade5cc0e724529841d354d54033 (diff)
Get rid of warnings/exceptions at cleanup
After the encoding index instance variable is removed when all instance variables are removed in `obj_free`, then `rb_str_free` causes uninitialized instance variable warning and nil-to-integer conversion exception. Both cases result in object allocation during GC, and crashes.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_encoding.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb
index 80bed39936..6fc5c48179 100644
--- a/test/ruby/test_encoding.rb
+++ b/test/ruby/test_encoding.rb
@@ -76,6 +76,9 @@ class TestEncoding < Test::Unit::TestCase
assert_equal("0", format % 0)
assert_equal(e, format.dup.encoding)
assert_equal(e, (format*1).encoding)
+
+ assert_equal(e, (("x"*30).force_encoding(e)*1).encoding)
+ GC.start
end;
end