summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/-ext-/integer/test_integer.rb4
-rw-r--r--test/lib/envutil.rb8
-rw-r--r--test/ruby/test_array.rb4
-rw-r--r--test/ruby/test_bignum.rb4
-rw-r--r--test/ruby/test_enum.rb4
-rw-r--r--test/ruby/test_marshal.rb2
-rw-r--r--test/ruby/test_numeric.rb2
7 files changed, 13 insertions, 15 deletions
diff --git a/test/-ext-/integer/test_integer.rb b/test/-ext-/integer/test_integer.rb
index 000cb78e4e..54f43f681e 100644
--- a/test/-ext-/integer/test_integer.rb
+++ b/test/-ext-/integer/test_integer.rb
@@ -3,8 +3,8 @@ require 'test/unit'
require '-test-/integer'
class TestInteger < Test::Unit::TestCase
- FIXNUM_MIN = Integer::FIXNUM_MIN
- FIXNUM_MAX = Integer::FIXNUM_MAX
+ FIXNUM_MIN = RbConfig::Limits['FIXNUM_MIN']
+ FIXNUM_MAX = RbConfig::Limits['FIXNUM_MAX']
def test_fixnum_range
assert_bignum(FIXNUM_MIN-1)
diff --git a/test/lib/envutil.rb b/test/lib/envutil.rb
index 60c924041c..71848473be 100644
--- a/test/lib/envutil.rb
+++ b/test/lib/envutil.rb
@@ -3,15 +3,13 @@
require "open3"
require "timeout"
require_relative "find_executable"
-require "rbconfig/sizeof"
begin
require 'rbconfig'
rescue LoadError
end
-
-class Integer
- FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2))
- FIXNUM_MAX = (1 << (8 * RbConfig::SIZEOF['long'] - 2)) - 1
+begin
+ require "rbconfig/sizeof"
+rescue LoadError
end
module EnvUtil
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index b0be0b4a87..9c0e4431dd 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -2759,8 +2759,8 @@ class TestArray < Test::Unit::TestCase
assert_raise(TypeError) {h.dig(1, 0)}
end
- FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2))
- FIXNUM_MAX = (1 << (8 * RbConfig::SIZEOF['long'] - 2)) - 1
+ FIXNUM_MIN = RbConfig::Limits['FIXNUM_MIN']
+ FIXNUM_MAX = RbConfig::Limits['FIXNUM_MAX']
def assert_typed_equal(e, v, cls, msg=nil)
assert_kind_of(cls, v, msg)
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index 15811d5d43..4cdf86d6d4 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -6,8 +6,8 @@ rescue LoadError
else
class TestBignum < Test::Unit::TestCase
- FIXNUM_MIN = Integer::FIXNUM_MIN
- FIXNUM_MAX = Integer::FIXNUM_MAX
+ FIXNUM_MIN = RbConfig::Limits['FIXNUM_MIN']
+ FIXNUM_MAX = RbConfig::Limits['FIXNUM_MAX']
BIGNUM_MIN = FIXNUM_MAX + 1
b = BIGNUM_MIN
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index c70ec7ceba..6c17c9e20a 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -184,8 +184,8 @@ class TestEnumerable < Test::Unit::TestCase
assert_equal(nil, @empty.inject() {9})
end
- FIXNUM_MIN = Integer::FIXNUM_MIN
- FIXNUM_MAX = Integer::FIXNUM_MAX
+ FIXNUM_MIN = RbConfig::Limits['FIXNUM_MIN']
+ FIXNUM_MAX = RbConfig::Limits['FIXNUM_MAX']
def test_inject_array_mul
assert_equal(nil, [].inject(:*))
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index bfc3f6df25..8a0b117cf6 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -622,7 +622,7 @@ class TestMarshal < Test::Unit::TestCase
def test_untainted_numeric
bug8945 = '[ruby-core:57346] [Bug #8945] Numerics never be tainted'
- b = Integer::FIXNUM_MAX + 1
+ b = RbConfig::Limits['FIXNUM_MAX'] + 1
tainted = [0, 1.0, 1.72723e-77, b].select do |x|
Marshal.load(Marshal.dump(x).taint).tainted?
end
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index 163d65334c..529ba70362 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -258,7 +258,7 @@ class TestNumeric < Test::Unit::TestCase
end
def test_step
- bignum = Integer::FIXNUM_MAX + 1
+ bignum = RbConfig::Limits['FIXNUM_MAX'] + 1
assert_raise(ArgumentError) { 1.step(10, 1, 0) { } }
assert_raise(ArgumentError) { 1.step(10, 1, 0).size }
assert_raise(ArgumentError) { 1.step(10, 0) { } }