summaryrefslogtreecommitdiff
path: root/test/json/json_generator_test.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2023-12-01 11:46:16 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-05 12:04:07 +0900
commita22ed8943859963c67533bb0edc13a27bfdac00c (patch)
treee4decf646df2fad4c5736f5a45479b691984b6e7 /test/json/json_generator_test.rb
parent5a2d70ef73d4d17f5999f5087499a5eda1126567 (diff)
[flori/json] JSON.dump: handle unenclosed hashes regression
Fix: https://github.com/flori/json/issues/553 We can never add keyword arguments to `dump` otherwise existing code using unenclosed hash will break. https://github.com/flori/json/commit/8e0076a3f2
Diffstat (limited to 'test/json/json_generator_test.rb')
-rwxr-xr-xtest/json/json_generator_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb
index 46cbf9c7f7..0ce5142327 100755
--- a/test/json/json_generator_test.rb
+++ b/test/json/json_generator_test.rb
@@ -62,6 +62,10 @@ EOT
assert_equal '666', generate(666)
end
+ def test_dump_unenclosed_hash
+ assert_equal '{"a":1,"b":2}', dump(a: 1, b: 2)
+ end
+
def test_generate_pretty
json = pretty_generate({})
assert_equal(<<'EOT'.chomp, json)