diff options
author | Jean Boussier <[email protected]> | 2024-04-17 09:59:50 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-04-17 10:35:14 +0200 |
commit | eac3dee9cdefcc414af832c99a95383a38790d1c (patch) | |
tree | 95ac1a8430339844c9314143f539674467cf32f4 /test/ruby/test_string.rb | |
parent | d31eda8eb636b9cc1ef343df5688f1abea3409c9 (diff) |
test_uplus_minus: Use a different string literal
This test fail relatively frequently and it's unclear what is
happening.
```
str: {"address":"0x7fbdeb26d4e0", "type":"STRING", "shape_id":1, "slot_size":40, "class":"0x7fbdd1e0ec50", "frozen":true, "embedded":true, "fstring":true, "bytesize":3, "value":"bar", "encoding":"UTF-8", "coderange":"7bit", "memsize":40, "flags":{"wb_protected":true, "old":true, "uncollectible":true, "marked":true}}
bar: {"address":"0x7fbdd0a8b138", "type":"STRING", "shape_id":1, "slot_size":40, "class":"0x7fbdd1e0ec50", "frozen":true, "embedded":true, "fstring":true, "bytesize":3, "value":"bar", "encoding":"UTF-8", "coderange":"7bit", "memsize":40, "flags":{"wb_protected":true}}
```
The `"bar".freeze` literal correctly put an old-gen fstring on the stack.
But `-%w(b a r).join('')` returns a young-gen fstring, which suggest it
somehow failed to find the old one in the `frozen_strings` table.
This could be caused by another test corrupting the table, or corrupting
the `"bar"` fstring.
By using a different literal value we can learn whether the bug is specific
to `"bar"` (used in many tests) or more general.
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 13261eacdd..ebe85dac82 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -3358,7 +3358,7 @@ CODE require 'objspace' - str = "bar".freeze + str = "test_uplus_minus_str".freeze assert_includes ObjectSpace.dump(str), '"fstring":true' assert_predicate(str, :frozen?) @@ -3368,7 +3368,7 @@ CODE assert_not_same(str, +str) assert_same(str, -str) - bar = -%w(b a r).join('') + bar = -%w(test uplus minus str).join('_') assert_same(str, bar, "uminus deduplicates [Feature #13077] str: #{ObjectSpace.dump(str)} bar: #{ObjectSpace.dump(bar)}") end |