Skip to content

Commit 5b76dc4

Browse files
committed
Add test coverage for T_BIGNUM parsing
1 parent fefb3ce commit 5b76dc4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/json/json_parser_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ def test_parse_numbers
131131
capture_output { assert_equal(Float::INFINITY, parse("23456789012E666")) }
132132
end
133133

134+
def test_parse_bignum
135+
bignum = Integer('1234567890' * 10)
136+
assert_equal(bignum, JSON.parse(bignum.to_s))
137+
assert_equal(bignum.to_f, JSON.parse(bignum.to_s + ".0"))
138+
end
139+
134140
def test_parse_bigdecimals
135141
assert_equal(BigDecimal, JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"].class)
136142
assert_equal(BigDecimal("0.901234567890123456789E1"),JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"] )

0 commit comments

Comments
 (0)