summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2017-04-18 10:55:57 +0200
committerFlorian Frank <flori@ping.de>2017-04-18 10:55:57 +0200
commit35f82850349a25de0df7732fcad10a3933f1dfd5 (patch)
tree6abd485fa91f6ac367ad2342da4b382c75445751
parent5ab3c81fe30600811f02faa0a9d815ac0f0d8f24 (diff)
parent3b7f8b0e76d6e5a33cbf0f91fe252b6625768512 (diff)
downloadjson-35f82850349a25de0df7732fcad10a3933f1dfd5.tar.gz
Merge branch 'test_bigdecimal_parsing' of https://github.com/xb/json
-rw-r--r--tests/json_parser_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/json_parser_test.rb b/tests/json_parser_test.rb
index 40ad500..f36e9c8 100644
--- a/tests/json_parser_test.rb
+++ b/tests/json_parser_test.rb
@@ -108,6 +108,11 @@ class JSONParserTest < Test::Unit::TestCase
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" => {} }]