diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2020-11-18 13:57:01 +0100 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-11-30 17:33:28 +0900 |
commit | 6bef49427ab2a9d3bc338f1cffcd086153a59f44 (patch) | |
tree | 3324d63fd62c7a95420967fce546d7143293f1a7 /test/-ext- | |
parent | 930a135524382ddd80c0608a7593b6cdfceee846 (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3786
Diffstat (limited to 'test/-ext-')
-rw-r--r-- | test/-ext-/string/test_interned_str.rb | 12 |
1 files changed, 12 insertions, 0 deletions
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 |