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

ruby-changes:42955

From: akr <ko1@a...>
Date: Tue, 17 May 2016 22:16:07 +0900 (JST)
Subject: [ruby-changes:42955] akr:r55029 (trunk): Use Integer instead of Fixnum and Bignum.

akr	2016-05-17 22:15:57 +0900 (Tue, 17 May 2016)

  New Revision: 55029

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

  Log:
    Use Integer instead of Fixnum and Bignum.
    
    * object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c,
      lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb,
      lib/rubygems/specification.rb, lib/uri/generic.rb,
      bootstraptest/test_eval.rb, basictest/test.rb,
      test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb,
      test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb,
      test/csv/test_data_converters.rb, test/date/test_date.rb,
      test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb,
      test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb,
      test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb,
      test/ruby/test_bignum.rb, test/ruby/test_case.rb,
      test/ruby/test_class.rb, test/ruby/test_complex.rb,
      test/ruby/test_enum.rb, test/ruby/test_eval.rb,
      test/ruby/test_iseq.rb, test/ruby/test_literal.rb,
      test/ruby/test_math.rb, test/ruby/test_module.rb,
      test/ruby/test_numeric.rb, test/ruby/test_range.rb,
      test/ruby/test_rational.rb, test/ruby/test_refinement.rb,
      test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb,
      test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb,
      test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum.

  Modified files:
    trunk/ChangeLog
    trunk/basictest/test.rb
    trunk/bootstraptest/test_eval.rb
    trunk/enum.c
    trunk/ext/-test-/bignum/mul.c
    trunk/lib/rexml/quickpath.rb
    trunk/lib/rexml/text.rb
    trunk/lib/rexml/xpath_parser.rb
    trunk/lib/rubygems/specification.rb
    trunk/lib/uri/generic.rb
    trunk/numeric.c
    trunk/object.c
    trunk/test/-ext-/bignum/test_big2str.rb
    trunk/test/-ext-/bignum/test_div.rb
    trunk/test/-ext-/bignum/test_mul.rb
    trunk/test/-ext-/bignum/test_str2big.rb
    trunk/test/csv/test_data_converters.rb
    trunk/test/date/test_date.rb
    trunk/test/json/test_json_generate.rb
    trunk/test/minitest/test_minitest_mock.rb
    trunk/test/openssl/test_cipher.rb
    trunk/test/rexml/test_jaxen.rb
    trunk/test/ruby/test_array.rb
    trunk/test/ruby/test_basicinstructions.rb
    trunk/test/ruby/test_bignum.rb
    trunk/test/ruby/test_case.rb
    trunk/test/ruby/test_class.rb
    trunk/test/ruby/test_complex.rb
    trunk/test/ruby/test_enum.rb
    trunk/test/ruby/test_eval.rb
    trunk/test/ruby/test_iseq.rb
    trunk/test/ruby/test_literal.rb
    trunk/test/ruby/test_math.rb
    trunk/test/ruby/test_module.rb
    trunk/test/ruby/test_numeric.rb
    trunk/test/ruby/test_range.rb
    trunk/test/ruby/test_rational.rb
    trunk/test/ruby/test_refinement.rb
    trunk/test/ruby/test_rubyvm.rb
    trunk/test/ruby/test_struct.rb
    trunk/test/ruby/test_variable.rb
    trunk/test/rubygems/test_gem_specification.rb
    trunk/test/thread/test_queue.rb
Index: enum.c
===================================================================
--- enum.c	(revision 55028)
+++ enum.c	(revision 55029)
@@ -657,8 +657,7 @@ ary_inject_op(VALUE ary, VALUE init, VAL https://github.com/ruby/ruby/blob/trunk/enum.c#L657
     id = SYM2ID(op);
     if (id == idPLUS) {
         if ((FIXNUM_P(v) || RB_TYPE_P(v, T_BIGNUM)) &&
-             rb_method_basic_definition_p(rb_cFixnum, idPLUS) &&
-             rb_method_basic_definition_p(rb_cBignum, idPLUS)) {
+             rb_method_basic_definition_p(rb_cInteger, idPLUS)) {
             n = 0;
             for (; i < RARRAY_LEN(ary); i++) {
                 e = RARRAY_AREF(ary, i);
Index: object.c
===================================================================
--- object.c	(revision 55028)
+++ object.c	(revision 55029)
@@ -2997,7 +2997,7 @@ rb_num_to_dbl(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L2997
 {
     if (SPECIAL_CONST_P(val)) {
 	if (FIXNUM_P(val)) {
-	    if (basic_to_f_p(rb_cFixnum))
+	    if (basic_to_f_p(rb_cInteger))
 		return fix2dbl_without_to_f(val);
 	}
 	else if (FLONUM_P(val)) {
@@ -3012,7 +3012,7 @@ rb_num_to_dbl(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L3012
 	  case T_FLOAT:
 	    return rb_float_noflonum_value(val);
 	  case T_BIGNUM:
-	    if (basic_to_f_p(rb_cBignum))
+	    if (basic_to_f_p(rb_cInteger))
 		return big2dbl_without_to_f(val);
 	    break;
 	  case T_RATIONAL:
Index: lib/uri/generic.rb
===================================================================
--- lib/uri/generic.rb	(revision 55028)
+++ lib/uri/generic.rb	(revision 55029)
@@ -683,7 +683,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L683
       if @opaque
         raise InvalidURIError,
           "can not set port with registry or opaque"
-      elsif !v.kind_of?(Fixnum) && parser.regexp[:PORT] !~ v
+      elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
         raise InvalidComponentError,
           "bad component(expected port component): #{v.inspect}"
       end
@@ -697,7 +697,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L697
     # see also URI::Generic.port=
     #
     def set_port(v)
-      v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Fixnum)
+      v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Integer)
       @port = v
     end
     protected :set_port
Index: lib/rubygems/specification.rb
===================================================================
--- lib/rubygems/specification.rb	(revision 55028)
+++ lib/rubygems/specification.rb	(revision 55029)
@@ -2696,9 +2696,9 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2696
             "#{full_name} contains itself (#{file_name}), check your files list"
     end
 
-    unless specification_version.is_a?(Fixnum)
+    unless specification_version.is_a?(Integer)
       raise Gem::InvalidSpecificationException,
-            'specification_version must be a Fixnum (did you mean version?)'
+            'specification_version must be a Integer (did you mean version?)'
     end
 
     case platform
Index: lib/rexml/text.rb
===================================================================
--- lib/rexml/text.rb	(revision 55028)
+++ lib/rexml/text.rb	(revision 55029)
@@ -33,7 +33,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/text.rb#L33
       VALID_XML_CHARS = Regexp.new('^['+
         VALID_CHAR.map { |item|
           case item
-          when Fixnum
+          when Integer
             [item].pack('U').force_encoding('utf-8')
           when Range
             [item.first, '-'.ord, item.last].pack('UUU').force_encoding('utf-8')
Index: lib/rexml/quickpath.rb
===================================================================
--- lib/rexml/quickpath.rb	(revision 55028)
+++ lib/rexml/quickpath.rb	(revision 55029)
@@ -194,7 +194,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/quickpath.rb#L194
         case res
         when true
           results << element
-        when Fixnum
+        when Integer
           results << element if Functions.pair[0] == res
         when String
           results << element
@@ -230,7 +230,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/quickpath.rb#L230
         case res
         when true
           results << element
-        when Fixnum
+        when Integer
           results << element if Functions.pair[0] == res
         end
       end
Index: lib/rexml/xpath_parser.rb
===================================================================
--- lib/rexml/xpath_parser.rb	(revision 55028)
+++ lib/rexml/xpath_parser.rb	(revision 55029)
@@ -17,7 +17,7 @@ class Symbol https://github.com/ruby/ruby/blob/trunk/lib/rexml/xpath_parser.rb#L17
   # to use across multiple Object types
   def dclone ; self ; end
 end
-class Fixnum
+class Integer
   # provides a unified +clone+ operation, for REXML::XPathParser
   # to use across multiple Object types
   def dclone ; self ; end
Index: ext/-test-/bignum/mul.c
===================================================================
--- ext/-test-/bignum/mul.c	(revision 55028)
+++ ext/-test-/bignum/mul.c	(revision 55029)
@@ -54,8 +54,8 @@ mul_gmp(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/mul.c#L54
 void
 Init_mul(VALUE klass)
 {
-    rb_define_const(rb_cBignum, "SIZEOF_BDIGIT", INT2NUM(SIZEOF_BDIGIT));
-    rb_define_const(rb_cBignum, "BITSPERDIG", INT2NUM(SIZEOF_BDIGIT * CHAR_BIT));
+    rb_define_const(rb_cInteger, "SIZEOF_BDIGIT", INT2NUM(SIZEOF_BDIGIT));
+    rb_define_const(rb_cInteger, "BITSPERDIG", INT2NUM(SIZEOF_BDIGIT * CHAR_BIT));
     rb_define_method(rb_cInteger, "big_mul_normal", mul_normal, 1);
     rb_define_method(rb_cInteger, "big_sq_fast", sq_fast, 0);
     rb_define_method(rb_cInteger, "big_mul_balance", mul_balance, 1);
Index: numeric.c
===================================================================
--- numeric.c	(revision 55028)
+++ numeric.c	(revision 55029)
@@ -213,11 +213,11 @@ positive_int_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L213
     const ID mid = '>';
 
     if (FIXNUM_P(num)) {
-	if (method_basic_p(rb_cFixnum))
+	if (method_basic_p(rb_cInteger))
 	    return FIXNUM_POSITIVE_P(num);
     }
     else if (RB_TYPE_P(num, T_BIGNUM)) {
-	if (method_basic_p(rb_cBignum))
+	if (method_basic_p(rb_cInteger))
 	    return BIGNUM_POSITIVE_P(num);
     }
     return RTEST(compare_with_zero(num, mid));
@@ -229,11 +229,11 @@ negative_int_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L229
     const ID mid = '<';
 
     if (FIXNUM_P(num)) {
-	if (method_basic_p(rb_cFixnum))
+	if (method_basic_p(rb_cInteger))
 	    return FIXNUM_NEGATIVE_P(num);
     }
     else if (RB_TYPE_P(num, T_BIGNUM)) {
-	if (method_basic_p(rb_cBignum))
+	if (method_basic_p(rb_cInteger))
 	    return BIGNUM_NEGATIVE_P(num);
     }
     return RTEST(compare_with_zero(num, mid));
@@ -706,11 +706,11 @@ num_positive_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L706
     const ID mid = '>';
 
     if (FIXNUM_P(num)) {
-	if (method_basic_p(rb_cFixnum))
+	if (method_basic_p(rb_cInteger))
 	    return (SIGNED_VALUE)num > (SIGNED_VALUE)INT2FIX(0) ? Qtrue : Qfalse;
     }
     else if (RB_TYPE_P(num, T_BIGNUM)) {
-	if (method_basic_p(rb_cBignum))
+	if (method_basic_p(rb_cInteger))
 	    return BIGNUM_POSITIVE_P(num) && !rb_bigzero_p(num) ? Qtrue : Qfalse;
     }
     return compare_with_zero(num, mid);
@@ -2317,11 +2317,11 @@ num_step_negative_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L2317
     VALUE r;
 
     if (FIXNUM_P(num)) {
-	if (method_basic_p(rb_cFixnum))
+	if (method_basic_p(rb_cInteger))
 	    return (SIGNED_VALUE)num < 0;
     }
     else if (RB_TYPE_P(num, T_BIGNUM)) {
-	if (method_basic_p(rb_cBignum))
+	if (method_basic_p(rb_cInteger))
 	    return BIGNUM_NEGATIVE_P(num);
     }
     r = rb_rescue(num_step_compare_with_zero, num, coerce_rescue_quiet, Qnil);
Index: test/minitest/test_minitest_mock.rb
===================================================================
--- test/minitest/test_minitest_mock.rb	(revision 55028)
+++ test/minitest/test_minitest_mock.rb	(revision 55029)
@@ -132,10 +132,10 @@ class TestMiniTestMock < MiniTest::Unit: https://github.com/ruby/ruby/blob/trunk/test/minitest/test_minitest_mock.rb#L132
   end
 
   def test_mock_is_a_blank_slate
-    @mock.expect :kind_of?, true, [Fixnum]
+    @mock.expect :kind_of?, true, [Integer]
     @mock.expect :==, true, [1]
 
-    assert @mock.kind_of?(Fixnum), "didn't mock :kind_of\?"
+    assert @mock.kind_of?(Integer), "didn't mock :kind_of\?"
     assert @mock == 1, "didn't mock :=="
   end
 
Index: test/ruby/test_enum.rb
===================================================================
--- test/ruby/test_enum.rb	(revision 55028)
+++ test/ruby/test_enum.rb	(revision 55029)
@@ -220,7 +220,7 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enum.rb#L220
 
   def test_inject_array_plus_redefined
     assert_separately([], <<-"end;")
-      class Fixnum
+      class Integer
         undef :+
         def +(x)
           0
@@ -228,15 +228,6 @@ class TestEnumerable < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_enum.rb#L228
       end
       assert_equal(0, [1,2,3].inject(:+), "[ruby-dev:49510] [Bug#12178]")
     end;
-    assert_separately([], <<-"end;")
-      class Bignum
-        undef :+
-        def +(x)
-          0
-        end
-      end
-      assert_equal(0, [#{FIXNUM_MAX},1,1].inject(:+))
-    end;
   end
 
   def test_partition
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 55028)
+++ test/ruby/test_module.rb	(revision 55029)
@@ -1695,7 +1695,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1695
           to_f / other
         end
       end
-      Fixnum.send(:prepend, M)
+      Integer.send(:prepend, M)
       assert_equal(0.5, 1 / 2, "#{bug7983}")
     }
     assert_equal(0, 1 / 2)
@@ -1706,7 +1706,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1706
     assert_separately [], %{
       module M
       end
-      class Fixnum
+      class Integer
         prepend M
         def /(other)
           quo(other)
@@ -1722,7 +1722,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1722
     assert_separately [], %{
       module M
       end
-      class Fixnum
+      class Integer
         prepend M
       end
       module M
Index: test/ruby/test_variable.rb
===================================================================
--- test/ruby/test_variable.rb	(revision 55028)
+++ test/ruby/test_variable.rb	(revision 55029)
@@ -36,7 +36,7 @@ class TestVariable < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L36
   end
 
   def test_variable
-    assert_instance_of(Fixnum, $$)
+    assert_instance_of(Integer, $$)
 
     # read-only variable
     assert_raise(NameError) do
Index: test/ruby/test_eval.rb
===================================================================
--- test/ruby/test_eval.rb	(revision 55028)
+++ test/ruby/test_eval.rb	(revision 55029)
@@ -402,10 +402,10 @@ class TestEval < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_eval.rb#L402
 
   def test_cvar_scope_with_instance_eval
     # TODO: check
-    Fixnum.class_eval "@@test_cvar_scope_with_instance_eval = 1" # depends on [ruby-dev:24229]
+    Integer.class_eval "@@test_cvar_scope_with_instance_eval = 1" # depends on [ruby-dev:24229]
     @@test_cvar_scope_with_instance_eval = 4
     assert_equal(4, 1.instance_eval("@@test_cvar_scope_with_instance_eval"), "[ruby-dev:24223]")
-    Fixnum.__send__(:remove_class_variable, :@@test_cvar_scope_with_instance_eval)
+    Integer.__send__(:remove_class_variable, :@@test_cvar_scope_with_instance_eval)
   end
 
   def test_eval_and_define_method
Index: test/ruby/test_literal.rb
===================================================================
--- test/ruby/test_literal.rb	(revision 55028)
+++ test/ruby/test_literal.rb	(revision 55029)
@@ -14,20 +14,20 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_literal.rb#L14
     assert_equal ':sym', :sym.inspect
     assert_instance_of Symbol, :sym
     assert_equal '1234', 1234.inspect
-    assert_instance_of Fixnum, 1234
+    assert_instance_of Integer, 1234
     assert_equal '1234', 1_2_3_4.inspect
-    assert_instance_of Fixnum, 1_2_3_4
+    assert_instance_of Integer, 1_2_3_4
     assert_equal '18', 0x12.inspect
-    assert_instance_of Fixnum, 0x12
+    assert_instance_of Integer, 0x12
     assert_raise(SyntaxError) { eval("0x") }
     assert_equal '15', 0o17.inspect
-    assert_instance_of Fixnum, 0o17
+    assert_instance_of Integer, 0o17
     assert_raise(SyntaxError) { eval("0o") }
     assert_equal '5', 0b101.inspect
-    assert_instance_of Fixnum, 0b101
+    assert_instance_of Integer, 0b101
     assert_raise(SyntaxError) { eval("0b") }
     assert_equal '123456789012345678901234567890', 123456789012345678901234567890.inspect
-    assert_instance_of Bignum, 123456789012345678901234567890
+    assert_instance_of Integer, 123456789012345678901234567890
     assert_instance_of Float, 1.3
     assert_equal '2', eval("0x00+2").inspect
   end
@@ -427,7 +427,7 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_literal.rb#L427
   end
 
   def test__LINE__
-    assert_instance_of Fixnum, __LINE__
+    assert_instance_of Integer, __LINE__
     assert_equal __LINE__, __LINE__
   end
 
Index: test/ruby/test_iseq.rb
===================================================================
--- test/ruby/test_iseq.rb	(revision 55028)
+++ test/ruby/test_iseq.rb	(revision 55029)
@@ -16,7 +16,7 @@ class TestISeq < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_iseq.rb#L16
 
   def lines src
     body = compile(src).to_a[13]
-    body.find_all{|e| e.kind_of? Fixnum}
+    body.find_all{|e| e.kind_of? Integer}
   end
 
   def test_to_a_lines
Index: test/ruby/test_class.rb
===================================================================
--- test/ruby/test_class.rb	(revision 55028)
+++ test/ruby/test_class.rb	(revision 55029)
@@ -46,9 +46,9 @@ class TestClass < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_class.rb#L46
     assert_same(Class, c.class)
     assert_same(Object, c.superclass)
 
-    c = Class.new(Fixnum)
+    c = Class.new(Integer)
     assert_same(Class, c.class)
-    assert_same(Fixnum, c.superclass)
+    assert_same(Integer, c.superclass)
   end
 
   def test_00_new_basic
Index: test/ruby/test_bignum.rb
===================================================================
--- test/ruby/test_bignum.rb	(revision 55028)
+++ test/ruby/test_bignum.rb	(revision 55029)
@@ -602,7 +602,7 @@ class TestBignum < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_bignum.rb#L602
   end
 
   def test_interrupt_during_to_s
-    if defined?(Bignum::GMP_VERSION)
+    if defined?(Integer::GMP_VERSION)
       return # GMP doesn't support interrupt during an operation.
     end
     time = Time.now
@@ -623,7 +623,7 @@ class TestBignum < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_bignum.rb#L623
   end
 
   def test_interrupt_during_bigdivrem
-    if defined?(Bignum::GMP_VERSION)
+    if defined?(Integer::GMP_VERSION)
       return # GMP doesn't support interrupt during an operation.
     end
     return unless Process.respond_to?(:kill)
Index: test/ruby/test_struct.rb
===================================================================
--- test/ruby/test_struct.rb	(revision 55028)
+++ test/ruby/test_struct.rb	(revision 55029)
@@ -248,7 +248,7 @@ module TestStruct https://github.com/ruby/ruby/blob/trunk/test/ruby/test_struct.rb#L248
   def test_hash
     klass = @Struct.new(:a)
     o = klass.new(1)
-    assert_kind_of(Fixnum, o.hash)
+    assert_fixnum(o.hash)
   end
 
   def test_eql
Index: test/ruby/test_basicinstructions.rb
===================================================================
--- test/ruby/test_basicinstructions.rb	(revision 55028)
+++ test/ruby/test_basicinstructions.rb	(revision 55029)
@@ -708,7 +708,7 @@ class TestBasicInstructions < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/ruby/test_basicinstructions.rb#L708
         @ivar
       end
     end
-    class Fixnum; include M; end
+    class Integer; include M; end
     class Float; include M; end
     class Symbol; include M; end
     class FalseClass; include M; end
Index: test/ruby/test_rational.rb
===================================================================
--- test/ruby/test_rational.rb	(revision 55028)
+++ test/ruby/test_rational.rb	(revision 55029)
@@ -42,7 +42,7 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L42
   end
 
   def test_hash
-    assert_instance_of(Fixnum, Rational(1,2).hash)
+    assert_fixnum(Rational(1,2).hash)
 
     h = {}
     h[Rational(0)] = 0
Index: test/ruby/test_case.rb
===================================================================
--- test/ruby/test_case.rb	(revision 55028)
+++ test/ruby/test_case.rb	(revision 55029)
@@ -81,7 +81,7 @@ class TestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_case.rb#L81
     EOS
 
     assert_in_out_err(['-e', <<-EOS], '', %w[42], [])
-      class Fixnum; undef ===; def ===(o); p 42; true; end; end; case 1; when 1; end
+      class Integer; undef ===; def ===(o); p 42; true; end; end; case 1; when 1; end
     EOS
   end
 
Index: test/ruby/test_array.rb
===================================================================
--- test/ruby/test_array.rb	(revision 55028)
+++ test/ruby/test_array.rb	(revision 55029)
@@ -495,7 +495,7 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L495
 
   def test_collect
     a = @cls[ 1, 'cat', 1..1 ]
-    assert_equal([ Fixnum, String, Range], a.collect {|e| e.class} )
+    assert_equal([ Integer, String, Range], a.collect {|e| e.class} )
     assert_equal([ 99, 99, 99], a.collect { 99 } )
 
     assert_equal([], @cls[].collect { 99 })
@@ -509,8 +509,8 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L509
   # also update map!
   def test_collect!
     a = @cls[ 1, 'cat', 1..1 ]
-    assert_equal([ Fixnum, String, Range], a.collect! {|e| e.class} )
-    assert_equal([ Fixnum, String, Range], a)
+    assert_equal([ Integer, String, Range], a.collect! {|e| e.class} )
+    assert_equal([ Integer, String, Range], a)
 
     a = @cls[ 1, 'cat', 1..1 ]
     assert_equal([ 99, 99, 99], a.collect! { 99 } )
@@ -588,7 +588,7 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L588
 
     assert_in_out_err [], <<-EOS, ["[]", "0"], [], bug8654
       ARY = Array.new(100) { |i| i }
-      class Fixnum
+      class Integer
         alias old_equal ==
         def == other
           ARY.replace([]) if self.equal?(0)
@@ -1074,8 +1074,8 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L1074
   # also update collect!
   def test_map!
     a = @cls[ 1, 'cat', 1..1 ]
-    assert_equal(@cls[ Fixnum, String, Range], a.map! {|e| e.class} )
-    assert_equal(@cls[ Fixnum, String, Range], a)
+    assert_equal(@cls[ Integer, String, Range], a.map! {|e| e.class} )
+    assert_equal(@cls[ Integer, String, Range], a)
 
     a = @cls[ 1, 'cat', 1..1 ]
     assert_equal(@cls[ 99, 99 (... truncated)

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

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