diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/json_addition_test.rb | 2 | ||||
-rw-r--r-- | tests/json_parser_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tests/json_addition_test.rb b/tests/json_addition_test.rb index e95ace8..614c735 100644 --- a/tests/json_addition_test.rb +++ b/tests/json_addition_test.rb @@ -165,7 +165,7 @@ class JSONAdditionTest < Test::Unit::TestCase def test_utc_datetime now = Time.now - d = DateTime.parse(now.to_s, :create_additions => true) # usual case + d = DateTime.parse(now.to_s) # usual case assert_equal d, parse(d.to_json, :create_additions => true) d = DateTime.parse(now.utc.to_s) # of = 0 assert_equal d, parse(d.to_json, :create_additions => true) diff --git a/tests/json_parser_test.rb b/tests/json_parser_test.rb index dce693e..146ff7c 100644 --- a/tests/json_parser_test.rb +++ b/tests/json_parser_test.rb @@ -84,6 +84,7 @@ class JSONParserTest < Test::Unit::TestCase assert_equal({ "a" => 23 }, parse(' { "a" : 23 } ')) assert_equal({ "a" => 0.23 }, parse(' { "a" : 0.23 } ')) assert_equal({ "a" => 0.23 }, parse(' { "a" : 0.23 } ')) + assert_equal({ "" => 123 }, parse('{"":123}')) end def test_parse_numbers @@ -114,6 +115,10 @@ class JSONParserTest < Test::Unit::TestCase assert_equal(BigDecimal("0.901234567890123456789E1"),JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"] ) end + def test_parse_string_mixed_unicode + assert_equal(["éé"], JSON.parse("[\"\\u00e9é\"]")) + 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" => {} }] |