mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 20:19:19 +00:00
Use Time.new because JSON.unsafe_load losts fractions of a second and
JSON.unsafe_load with Time object returns String ``` 1) Failure: JSONCommonInterfaceTest#test_unsafe_load_default_options [/path/to/ruby/test/json/json_common_interface_test.rb:230]: <2025-09-03 14:28:31.293635 +0200> expected but was <"2025-09-03 14:28:31 +0200">. ```
This commit is contained in:
parent
9af5af2c7d
commit
837d74104c
@ -226,8 +226,8 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase
|
||||
nan_json = '{ "foo": NaN }'
|
||||
assert JSON.unsafe_load(nan_json, nil)['foo'].nan?
|
||||
assert_equal nil, JSON.unsafe_load(nil, nil)
|
||||
t = Time.now
|
||||
assert_equal t, JSON.unsafe_load(JSON(t))
|
||||
t = Time.new(2025, 9, 3, 14, 50, 0)
|
||||
assert_equal t.to_s, JSON.unsafe_load(JSON(t)).to_s
|
||||
end
|
||||
|
||||
def test_unsafe_load_with_options
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user