diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-11-06 11:57:02 -0800 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-11-06 11:57:02 -0800 |
commit | 3b35de2a90e26b99e2a6d4f61dc56d6ce7ded748 (patch) | |
tree | f66334a0ad8cf59590dd682d95d6244e8b454853 /test/psych/test_numeric.rb | |
download | ruby-3b35de2a90e26b99e2a6d4f61dc56d6ce7ded748.tar.gz ruby-3b35de2a90e26b99e2a6d4f61dc56d6ce7ded748.tar.bz2 ruby-3b35de2a90e26b99e2a6d4f61dc56d6ce7ded748.zip |
Imported Upstream version 1.9.3.p194upstream/1.9.3.p194
Diffstat (limited to 'test/psych/test_numeric.rb')
-rw-r--r-- | test/psych/test_numeric.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/psych/test_numeric.rb b/test/psych/test_numeric.rb new file mode 100644 index 0000000..bae723a --- /dev/null +++ b/test/psych/test_numeric.rb @@ -0,0 +1,25 @@ +require 'psych/helper' +require 'bigdecimal' + +module Psych + ### + # Test numerics from YAML spec: + # http://yaml.org/type/float.html + # http://yaml.org/type/int.html + class TestNumeric < TestCase + def test_non_float_with_0 + 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 |