From 10a9f14d00add45b3f7b3b17f21ba87b6f187f6d Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 6 Apr 2017 02:10:40 +0000 Subject: Rename RbConfig::Limits as RbConfig::LIMITS * template/limits.c.tmpl (Init_limits): rename RbConfig::Limits as RbConfig::LIMITS, constants other than class or module are all uppercase with underscores by convention. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- NEWS | 4 ++++ bootstraptest/test_insns.rb | 4 ++-- template/limits.c.tmpl | 2 +- test/-ext-/integer/test_integer.rb | 4 ++-- test/-ext-/num2int/test_num2int.rb | 2 +- test/ruby/test_array.rb | 4 ++-- test/ruby/test_bignum.rb | 4 ++-- test/ruby/test_enum.rb | 4 ++-- test/ruby/test_marshal.rb | 2 +- test/ruby/test_numeric.rb | 2 +- test/ruby/test_string.rb | 2 +- 11 files changed, 19 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 2a5de6673e..93145942aa 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,10 @@ with all sufficient information, see the ChangeLog file or Redmine === Stdlib updates (outstanding ones only) +* RbConfig + * New constants: + * RbConfig::LIMITS is added to provide the limits of C types. + === Compatibility issues (excluding feature bug fixes) * Random.raw_seed renamed to become Random.urandom. It is now diff --git a/bootstraptest/test_insns.rb b/bootstraptest/test_insns.rb index 83457e0653..4f533c6906 100644 --- a/bootstraptest/test_insns.rb +++ b/bootstraptest/test_insns.rb @@ -10,8 +10,8 @@ begin rescue LoadError # OK, just skip else - $FIXNUM_MAX = RbConfig::Limits["FIXNUM_MAX"] - $FIXNUM_MIN = RbConfig::Limits["FIXNUM_MIN"] + $FIXNUM_MAX = RbConfig::LIMITS["FIXNUM_MAX"] + $FIXNUM_MIN = RbConfig::LIMITS["FIXNUM_MIN"] end fsl = { frozen_string_literal: true } # used later diff --git a/template/limits.c.tmpl b/template/limits.c.tmpl index f4ecaf62f9..6b7610a030 100644 --- a/template/limits.c.tmpl +++ b/template/limits.c.tmpl @@ -55,7 +55,7 @@ void Init_limits(void) { VALUE h = rb_hash_new(); - rb_define_const(rb_define_module("RbConfig"), "Limits", h); + rb_define_const(rb_define_module("RbConfig"), "LIMITS", h); #ifdef HAVE_LONG_LONG #ifndef ULLONG_MAX diff --git a/test/-ext-/integer/test_integer.rb b/test/-ext-/integer/test_integer.rb index 54f43f681e..320237791a 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 = RbConfig::Limits['FIXNUM_MIN'] - FIXNUM_MAX = RbConfig::Limits['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/-ext-/num2int/test_num2int.rb b/test/-ext-/num2int/test_num2int.rb index 0b12209134..5d310af40d 100644 --- a/test/-ext-/num2int/test_num2int.rb +++ b/test/-ext-/num2int/test_num2int.rb @@ -5,7 +5,7 @@ require '-test-/integer' require 'rbconfig/sizeof' class TestNum2int < Test::Unit::TestCase - l = RbConfig::Limits + l = RbConfig::LIMITS SHRT_MIN = l["SHRT_MIN"] SHRT_MAX = l["SHRT_MAX"] diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 3cfd3d764d..fbc0790f0f 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -2778,8 +2778,8 @@ class TestArray < Test::Unit::TestCase assert_raise(TypeError) {h.dig(1, 0)} end - FIXNUM_MIN = RbConfig::Limits['FIXNUM_MIN'] - FIXNUM_MAX = RbConfig::Limits['FIXNUM_MAX'] + 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 4cdf86d6d4..e680d28735 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 = RbConfig::Limits['FIXNUM_MIN'] - FIXNUM_MAX = RbConfig::Limits['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 6c17c9e20a..27d406680a 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 = RbConfig::Limits['FIXNUM_MIN'] - FIXNUM_MAX = RbConfig::Limits['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 8a0b117cf6..48a7d03428 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 = RbConfig::Limits['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 529ba70362..92717e9f3b 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 = RbConfig::Limits['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) { } } diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 7dbf27e552..0bfca5ad05 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -203,7 +203,7 @@ CODE assert_raise(ArgumentError) { "foo"[1, 2, 3] = "" } - assert_raise(IndexError) {"foo"[RbConfig::Limits["LONG_MIN"]] = "l"} + assert_raise(IndexError) {"foo"[RbConfig::LIMITS["LONG_MIN"]] = "l"} end def test_CMP # '<=>' -- cgit v1.2.3