Skip to content

Commit 06c6f7d

Browse files
herwinwandrykonchin
authored andcommitted
Add spec for Hash#to_s/inspect in Ruby 3.4 with keys that require quotes
1 parent 9e65467 commit 06c6f7d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/hash/shared/to_s.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,10 @@
8484
expected = ruby_version_is("3.4") ? "{true => false}" : "{true=>false}"
8585
{ true => false }.to_s.should == expected
8686
end
87+
88+
ruby_version_is "3.4" do
89+
it "adds quotes to symbol keys that are not valid symbol literals" do
90+
{ "needs-quotes": 1 }.send(@method).should == '{"needs-quotes": 1}'
91+
end
92+
end
8793
end

0 commit comments

Comments
 (0)