Skip to content

Commit

Permalink
Merge pull request #638 from ruby/extract-bigdecimal
Browse files Browse the repository at this point in the history
Skip BigDecimal tests when it's missing to load
  • Loading branch information
hsbt committed Jul 18, 2023
2 parents c7c3963 + e1dbfae commit 9de928f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/psych/test_numeric.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# frozen_string_literal: true
require_relative 'helper'
require 'bigdecimal'
begin
require 'bigdecimal'
rescue LoadError
end

module Psych
###
Expand Down Expand Up @@ -29,13 +32,13 @@ def test_non_float_with_0
def test_big_decimal_tag
decimal = BigDecimal("12.34")
assert_match "!ruby/object:BigDecimal", Psych.dump(decimal)
end
end if defined?(BigDecimal)

def test_big_decimal_round_trip
decimal = BigDecimal("12.34")
$DEBUG = false
assert_cycle decimal
end
end if defined?(BigDecimal)

def test_does_not_attempt_numeric
str = Psych.load('--- 4 roses')
Expand Down

0 comments on commit 9de928f

Please sign in to comment.