diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-18 03:44:09 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-18 03:44:09 +0000 |
commit | cf2bbc89d26ef29ab33b3a11a71c30ffba35fe2f (patch) | |
tree | 91998add7a4b54eb287a784a336ac49db79985aa /test/psych | |
parent | 7cabeff61a25e37517afcdc4fb164a9365f5e30c (diff) | |
download | ruby-cf2bbc89d26ef29ab33b3a11a71c30ffba35fe2f.tar.gz |
* ext/psych/lib/psych/visitors/to_ruby.rb: BigDecimals can be restored
from YAML.
* ext/psych/lib/psych/visitors/yaml_tree.rb: BigDecimals can be dumped
to YAML.
* test/psych/test_numeric.rb: tests for BigDecimal serialization
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r-- | test/psych/test_numeric.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/psych/test_numeric.rb b/test/psych/test_numeric.rb index 9adb058a32..bae723aca9 100644 --- a/test/psych/test_numeric.rb +++ b/test/psych/test_numeric.rb @@ -1,4 +1,5 @@ require 'psych/helper' +require 'bigdecimal' module Psych ### @@ -10,5 +11,15 @@ module Psych str = Psych.load('--- 090') assert_equal '090', str end + + def test_big_decimal_tag + decimal = BigDecimal("12.34") + assert_match "!ruby/object:BigDecimal", Psych.dump(decimal) + end + + def test_big_decimal_round_trip + decimal = BigDecimal("12.34") + assert_cycle decimal + end end end |