* ext/json/*, test/json/*: Update json-2.0.1.

Changes of 2.0.0: f679ebd0c6/CHANGES.md (2015-09-11-200)
  Changes of 2.0.1: f679ebd0c6/CHANGES.md (2016-07-01-201)
  [Feature #12542][ruby-dev:49706][fix GH-1395]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2016-07-05 11:49:39 +00:00
parent 5eff15d1bd
commit 1130658738
27 changed files with 1159 additions and 1498 deletions

View file

@ -1,9 +1,6 @@
#!/usr/bin/env ruby
# encoding: utf-8
# frozen_string_literal: false
require 'test_helper'
require 'test/unit'
require File.join(File.dirname(__FILE__), 'setup_variant')
class TestJSONGenericObject < Test::Unit::TestCase
include JSON
@ -27,11 +24,20 @@ class TestJSONGenericObject < Test::Unit::TestCase
end
def test_parse_json
assert_kind_of Hash, JSON('{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }', :create_additions => true)
assert_kind_of Hash,
JSON(
'{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }',
:create_additions => true
)
switch_json_creatable do
assert_equal @go, l = JSON('{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }', :create_additions => true)
assert_equal @go, l =
JSON(
'{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }',
:create_additions => true
)
assert_equal 1, l.a
assert_equal @go, l = JSON('{ "a": 1, "b": 2 }', :object_class => GenericObject)
assert_equal @go,
l = JSON('{ "a": 1, "b": 2 }', :object_class => GenericObject)
assert_equal 1, l.a
assert_equal GenericObject[:a => GenericObject[:b => 2]],
l = JSON('{ "a": { "b": 2 } }', :object_class => GenericObject)