diff options
author | Florian Frank <flori@ping.de> | 2011-11-21 19:45:11 +0100 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2011-11-21 19:45:11 +0100 |
commit | 1f2e458686fec42a4ee3cf3b7d5ab1b6d9ee4b93 (patch) | |
tree | 61870ec7c48cdbbcca94b226c150deb83cf627cb /tests | |
parent | 4ee26ac90981bbe5d7b5114ddd5036a5cea24251 (diff) | |
download | json-1f2e458686fec42a4ee3cf3b7d5ab1b6d9ee4b93.tar.gz |
Add support for OpenStruct
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_json_addition.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb index b9cc6d1..1b85e02 100755 --- a/tests/test_json_addition.rb +++ b/tests/test_json_addition.rb @@ -7,6 +7,7 @@ require 'json/add/core' require 'json/add/complex' require 'json/add/rational' require 'json/add/bigdecimal' +require 'json/add/ostruct' require 'date' class TC_JSONAddition < Test::Unit::TestCase @@ -177,4 +178,11 @@ class TC_JSONAddition < Test::Unit::TestCase assert_equal BigDecimal('3.141', 23), JSON(JSON(BigDecimal('3.141', 23))) assert_equal BigDecimal('3.141', 666), JSON(JSON(BigDecimal('3.141', 666))) end + + def test_ostruct + o = OpenStruct.new + # XXX this won't work; o.foo = { :bar => true } + o.foo = { 'bar' => true } + assert_equal o, JSON(JSON(o)) + end end |