Skip to content

Commit

Permalink
Actually test BigDecimal parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuân Baldauf committed Mar 19, 2017
1 parent c9fc0f0 commit 3b7f8b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/json_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ def test_parse_numbers
assert_equal -1.0/0, parse('-Infinity', :allow_nan => true)
end

def test_parse_bigdecimals
assert_equal(BigDecimal, JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"].class)
assert_equal(BigDecimal.new("0.901234567890123456789E1"),JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"] )
end

if Array.method_defined?(:permutation)
def test_parse_more_complex_arrays
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
Expand Down

0 comments on commit 3b7f8b0

Please sign in to comment.