summaryrefslogtreecommitdiff
path: root/tests/test_json_addition.rb
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2011-12-21 11:05:46 +0100
committerFlorian Frank <flori@ping.de>2011-12-21 11:05:46 +0100
commit60ef7adb347b473cbcce9aacacb2943ae5fb4d4c (patch)
treeba73bea0660d74b2a9a787c5e0acd1a06739e1b6 /tests/test_json_addition.rb
parent0dacb54bcdf3c40cc38dae26f04b780024460b45 (diff)
parent59ecfad89281873fe72234b62545294b5fa7ba95 (diff)
downloadjson-MagLev-master.tar.gz
Merge branch 'master' of https://github.com/MagLev/json into MagLev-masterMagLev-master
Diffstat (limited to 'tests/test_json_addition.rb')
-rwxr-xr-xtests/test_json_addition.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb
index b9cc6d1..e262e25 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
@@ -129,7 +130,7 @@ class TC_JSONAddition < Test::Unit::TestCase
def test_core
t = Time.now
- assert_equal t.inspect, JSON(JSON(t)).inspect
+ assert_equal t, JSON(JSON(t))
d = Date.today
assert_equal d, JSON(JSON(d))
d = DateTime.civil(2007, 6, 14, 14, 57, 10, Rational(1, 12), 2299161)
@@ -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