[前][次][番号順一覧][スレッド一覧]

ruby-changes:64700

From: Kenta <ko1@a...>
Date: Sat, 2 Jan 2021 00:46:39 +0900 (JST)
Subject: [ruby-changes:64700] 5ee6830abe (master): [ruby/bigdecimal] Fix test_limit

https://git.ruby-lang.org/ruby.git/commit/?id=5ee6830abe

From 5ee6830abe7d99cd95c9c7a6f252a3692b57c5bc Mon Sep 17 00:00:00 2001
From: Kenta Murata <mrkn@m...>
Date: Sat, 2 Jan 2021 00:27:46 +0900
Subject: [ruby/bigdecimal] Fix test_limit

Keep the default value of BigDecimal.limit by BigDecimal.save_limit
to avoid failures of the other test methods due to the unexpected limit.

https://github.com/ruby/bigdecimal/commit/bdc1cc6585

diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index 16f5505..91cf728 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -1495,16 +1495,17 @@ class TestBigDecimal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/bigdecimal/test_bigdecimal.rb#L1495
   end
 
   def test_limit
-    BigDecimal.limit(1)
-    x = BigDecimal("3")
-    assert_equal(90, x ** 4) # OK? must it be 80?
-    # 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ???
-    assert_raise(ArgumentError) { BigDecimal.limit(-1) }
-
-    bug7458 = '[ruby-core:50269] [#7458]'
-    one = BigDecimal('1')
-    epsilon = BigDecimal('0.7E-18')
     BigDecimal.save_limit do
+      BigDecimal.limit(1)
+      x = BigDecimal("3")
+      assert_equal(90, x ** 4) # OK? must it be 80?
+      # 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ???
+      assert_raise(ArgumentError) { BigDecimal.limit(-1) }
+
+      bug7458 = '[ruby-core:50269] [#7458]'
+      one = BigDecimal('1')
+      epsilon = BigDecimal('0.7E-18')
+
       BigDecimal.limit(0)
       assert_equal(BigDecimal("1.0000000000000000007"), one + epsilon, "limit(0) #{bug7458}")
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]