From 6bef49427ab2a9d3bc338f1cffcd086153a59f44 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 18 Nov 2020 13:57:01 +0100 Subject: Fix rb_interned_str_* functions to not assume static strings Fixes [Feature #13381] When passed a `fake_str`, `register_fstring` would create new strings with `str_new_static`. That's not what was expected, and answer almost no use cases. --- test/-ext-/string/test_interned_str.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/-ext-/string/test_interned_str.rb (limited to 'test/-ext-/string') diff --git a/test/-ext-/string/test_interned_str.rb b/test/-ext-/string/test_interned_str.rb new file mode 100644 index 0000000000..340dba41e8 --- /dev/null +++ b/test/-ext-/string/test_interned_str.rb @@ -0,0 +1,12 @@ +require 'test/unit' +require '-test-/string' + +class Test_RbInternedStr < Test::Unit::TestCase + def test_interned_str + src = "a" * 20 + interned_str = Bug::String.rb_interned_str_dup(src) + src.clear + src << "b" * 20 + assert_equal "a" * 20, interned_str + end +end -- cgit v1.2.1