From c6801b66951c83344d6f10029ae9b6958a12def7 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 18 Apr 2012 10:30:51 +0200 Subject: Add implementation for a light object --- tests/test_json.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/test_json.rb b/tests/test_json.rb index 1b39360..f69817f 100755 --- a/tests/test_json.rb +++ b/tests/test_json.rb @@ -314,6 +314,16 @@ class TC_JSON < Test::Unit::TestCase assert res.item_set? end + def test_parse_light_object + res = parse('{"foo":"bar", "baz":{}}', :object_class => JSON::LightObject) + assert_equal(JSON::LightObject, res.class) + assert_equal "bar", res.foo + assert_equal "bar", res["foo"] + assert_equal "bar", res[:foo] + assert_equal "bar", res.to_hash[:foo] + assert_equal(JSON::LightObject, res.baz.class) + end + def test_generate_core_subclasses_with_new_to_json obj = SubHash2["foo" => SubHash2["bar" => true]] obj_json = JSON(obj) -- cgit v1.2.1