Commit 30a42a70

30a42a708d70Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · +2 added

Description

Add regression test for empty-string to_sym

"".to_sym == :"" is correct in the current tree (an empty symbol once broke the build). Lock it in: the empty string and the :"" literal must intern to the same symbol id, and round-trip back to "".

Closes #1309

Co-Authored-By: Claude Opus 4.8 [email protected]

Details

Commit
30a42a708d70
Parent
58a4fb703932

test/empty_string_to_sym.rbaddedView file

1+# Empty-string interning: "".to_sym and the :"" literal must resolve to the
2+# same symbol id (an empty symbol once broke the C build).
3+p("".to_sym == :"")
4+p(:"" == "".to_sym)
5+p("abc".to_sym == :abc)
6+p("".to_sym.to_s == "")