Sha256: e9eb859cf48ee69c3ef0bc58caeaefc3f44a24355310dab62f2c8348dafd3bdc

Contents?: true

Size: 559 Bytes

Versions: 5

Compression:

Stored size: 559 Bytes

Contents

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
psych-1.3.4 test/psych/test_numeric.rb
psych-1.3.3 test/psych/test_numeric.rb
psych-1.3.2 test/psych/test_numeric.rb
psych-1.3.1 test/psych/test_numeric.rb
psych-1.3.0 test/psych/test_numeric.rb