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

ruby-changes:46146

From: nobu <ko1@a...>
Date: Thu, 6 Apr 2017 11:10:46 +0900 (JST)
Subject: [ruby-changes:46146] nobu:r58260 (trunk): Rename RbConfig::Limits as RbConfig::LIMITS

nobu	2017-04-06 11:10:40 +0900 (Thu, 06 Apr 2017)

  New Revision: 58260

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58260

  Log:
    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.

  Modified files:
    trunk/NEWS
    trunk/bootstraptest/test_insns.rb
    trunk/template/limits.c.tmpl
    trunk/test/-ext-/integer/test_integer.rb
    trunk/test/-ext-/num2int/test_num2int.rb
    trunk/test/ruby/test_array.rb
    trunk/test/ruby/test_bignum.rb
    trunk/test/ruby/test_enum.rb
    trunk/test/ruby/test_marshal.rb
    trunk/test/ruby/test_numeric.rb
    trunk/test/ruby/test_string.rb
Index: NEWS
===================================================================
--- NEWS	(revision 58259)
+++ NEWS	(revision 58260)
@@ -51,6 +51,10 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L51
 
 === 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
Index: test/ruby/test_array.rb
===================================================================
--- test/ruby/test_array.rb	(revision 58259)
+++ test/ruby/test_array.rb	(revision 58260)
@@ -2778,8 +2778,8 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L2778
     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)
Index: test/ruby/test_numeric.rb
===================================================================
--- test/ruby/test_numeric.rb	(revision 58259)
+++ test/ruby/test_numeric.rb	(revision 58260)
@@ -258,7 +258,7 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_numeric.rb#L258
   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) { } }
Index: test/ruby/test_enum.rb
===================================================================
--- test/ruby/test_enum.rb	(revision 58259)
+++ test/ruby/test_enum.rb	(revision 58260)
@@ -184,8 +184,8 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enum.rb#L184
     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(:*))
Index: test/ruby/test_bignum.rb
===================================================================
--- test/ruby/test_bignum.rb	(revision 58259)
+++ test/ruby/test_bignum.rb	(revision 58260)
@@ -6,8 +6,8 @@ rescue LoadError https://github.com/ruby/ruby/blob/trunk/test/ruby/test_bignum.rb#L6
 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
Index: test/ruby/test_marshal.rb
===================================================================
--- test/ruby/test_marshal.rb	(revision 58259)
+++ test/ruby/test_marshal.rb	(revision 58260)
@@ -622,7 +622,7 @@ class TestMarshal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_marshal.rb#L622
 
   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
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 58259)
+++ test/ruby/test_string.rb	(revision 58260)
@@ -203,7 +203,7 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L203
 
     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 # '<=>'
Index: test/-ext-/num2int/test_num2int.rb
===================================================================
--- test/-ext-/num2int/test_num2int.rb	(revision 58259)
+++ test/-ext-/num2int/test_num2int.rb	(revision 58260)
@@ -5,7 +5,7 @@ require '-test-/integer' https://github.com/ruby/ruby/blob/trunk/test/-ext-/num2int/test_num2int.rb#L5
 require 'rbconfig/sizeof'
 
 class TestNum2int < Test::Unit::TestCase
-  l = RbConfig::Limits
+  l = RbConfig::LIMITS
 
   SHRT_MIN = l["SHRT_MIN"]
   SHRT_MAX = l["SHRT_MAX"]
Index: test/-ext-/integer/test_integer.rb
===================================================================
--- test/-ext-/integer/test_integer.rb	(revision 58259)
+++ test/-ext-/integer/test_integer.rb	(revision 58260)
@@ -3,8 +3,8 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/test/-ext-/integer/test_integer.rb#L3
 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)
Index: template/limits.c.tmpl
===================================================================
--- template/limits.c.tmpl	(revision 58259)
+++ template/limits.c.tmpl	(revision 58260)
@@ -55,7 +55,7 @@ void https://github.com/ruby/ruby/blob/trunk/template/limits.c.tmpl#L55
 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
Index: bootstraptest/test_insns.rb
===================================================================
--- bootstraptest/test_insns.rb	(revision 58259)
+++ bootstraptest/test_insns.rb	(revision 58260)
@@ -10,8 +10,8 @@ begin https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L10
 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

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

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