summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2011-11-21 19:45:11 +0100
committerFlorian Frank <flori@ping.de>2011-11-21 19:45:11 +0100
commit1f2e458686fec42a4ee3cf3b7d5ab1b6d9ee4b93 (patch)
tree61870ec7c48cdbbcca94b226c150deb83cf627cb /tests
parent4ee26ac90981bbe5d7b5114ddd5036a5cea24251 (diff)
downloadjson-1f2e458686fec42a4ee3cf3b7d5ab1b6d9ee4b93.tar.gz
Add support for OpenStruct
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_json_addition.rb8
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