JSON::Pure fix strict mode
Followup: https://github.com/flori/json/pull/519 Fix: https://github.com/flori/json/issues/584
This commit is contained in:
parent
ea9d34082f
commit
8fdd3d0ed6
@ -67,6 +67,25 @@ EOT
|
|||||||
|
|
||||||
def test_dump_strict
|
def test_dump_strict
|
||||||
assert_equal '{}', dump({}, strict: true)
|
assert_equal '{}', dump({}, strict: true)
|
||||||
|
|
||||||
|
assert_equal '{"array":[42,4.2,"forty-two",true,false,null]}', dump({
|
||||||
|
"array" => [42, 4.2, "forty-two", true, false, nil]
|
||||||
|
}, strict: true)
|
||||||
|
|
||||||
|
assert_equal '{"int":42,"float":4.2,"string":"forty-two","true":true,"false":false,"nil":null,"hash":{}}', dump({
|
||||||
|
"int" => 42,
|
||||||
|
"float" => 4.2,
|
||||||
|
"string" => "forty-two",
|
||||||
|
"true" => true,
|
||||||
|
"false" => false,
|
||||||
|
"nil" => nil,
|
||||||
|
"hash" => {},
|
||||||
|
}, strict: true)
|
||||||
|
|
||||||
|
assert_equal '[]', dump([], strict: true)
|
||||||
|
|
||||||
|
assert_equal '42', dump(42, strict: true)
|
||||||
|
assert_equal 'true', dump(true, strict: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_generate_pretty
|
def test_generate_pretty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user