summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-17 19:45:07 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-17 19:45:07 -0800
commit33ce8650bac29190dde937b1b7d3e21fd06926e7 (patch)
treecd76ef712ba565c1189ece2b4e098e823e6497aa /test
parent1caecdca27675e80f9a762875fcf7ced81b2d9f1 (diff)
downloadpsych-33ce8650bac29190dde937b1b7d3e21fd06926e7.zip
* 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 Fixes #31
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_numeric.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/psych/test_numeric.rb b/test/psych/test_numeric.rb
index 9adb058..bae723a 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