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

ruby-changes:49324

From: mrkn <ko1@a...>
Date: Sun, 24 Dec 2017 15:22:46 +0900 (JST)
Subject: [ruby-changes:49324] mrkn:r61441 (trunk): bigdecimal: version 1.3.4

mrkn	2017-12-24 15:22:41 +0900 (Sun, 24 Dec 2017)

  New Revision: 61441

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

  Log:
    bigdecimal: version 1.3.4
    
    Import bigdecimal version 1.3.4.  The full commit log is here:
    
      https://github.com/ruby/bigdecimal/compare/v1.3.3...v1.3.4

  Modified files:
    trunk/ext/bigdecimal/bigdecimal.c
    trunk/ext/bigdecimal/bigdecimal.gemspec
    trunk/test/bigdecimal/test_bigdecimal.rb
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 61440)
+++ ext/bigdecimal/bigdecimal.c	(revision 61441)
@@ -2602,7 +2602,7 @@ static Real *BigDecimal_new(int argc, VA https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2602
 static VALUE
 BigDecimal_s_new(int argc, VALUE *argv, VALUE self)
 {
-  rb_warning("BigDecimal.new is deprecated");
+  rb_warning("BigDecimal.new is deprecated; use Kernel.BigDecimal method instead.");
   return rb_call_super(argc, argv);
 }
 
@@ -2645,15 +2645,7 @@ BigDecimal_initialize_copy(VALUE self, V https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2645
 static VALUE
 BigDecimal_clone(VALUE self)
 {
-  rb_warning("BigDecimal#clone is deprecated.");
-  return rb_call_super(0, NULL);
-}
-
-static VALUE
-BigDecimal_dup(VALUE self)
-{
-  rb_warning("BigDecimal#dup is deprecated.");
-  return rb_call_super(0, NULL);
+  return self;
 }
 
 static Real *
@@ -3449,7 +3441,7 @@ Init_bigdecimal(void) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L3441
     rb_define_method(rb_cBigDecimal, "remainder", BigDecimal_remainder, 1);
     rb_define_method(rb_cBigDecimal, "divmod", BigDecimal_divmod, 1);
     rb_define_method(rb_cBigDecimal, "clone", BigDecimal_clone, 0);
-    rb_define_method(rb_cBigDecimal, "dup", BigDecimal_dup, 0);
+    rb_define_method(rb_cBigDecimal, "dup", BigDecimal_clone, 0);
     rb_define_method(rb_cBigDecimal, "to_f", BigDecimal_to_f, 0);
     rb_define_method(rb_cBigDecimal, "abs", BigDecimal_abs, 0);
     rb_define_method(rb_cBigDecimal, "sqrt", BigDecimal_sqrt, 1);
Index: ext/bigdecimal/bigdecimal.gemspec
===================================================================
--- ext/bigdecimal/bigdecimal.gemspec	(revision 61440)
+++ ext/bigdecimal/bigdecimal.gemspec	(revision 61441)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.gemspec#L1
 # coding: utf-8
 
-bigdecimal_version = '1.3.3'
+bigdecimal_version = '1.3.4'
 
 Gem::Specification.new do |s|
   s.name          = "bigdecimal"
Index: test/bigdecimal/test_bigdecimal.rb
===================================================================
--- test/bigdecimal/test_bigdecimal.rb	(revision 61440)
+++ test/bigdecimal/test_bigdecimal.rb	(revision 61441)
@@ -2,8 +2,6 @@ https://github.com/ruby/ruby/blob/trunk/test/bigdecimal/test_bigdecimal.rb#L2
 require_relative "testbase"
 require 'bigdecimal/math'
 
-require 'thread'
-
 class TestBigDecimal < Test::Unit::TestCase
   include TestBigDecimalBase
 
@@ -1777,25 +1775,27 @@ class TestBigDecimal < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/bigdecimal/test_bigdecimal.rb#L1775
   end
 
   def test_clone
-    assert_warning(/BigDecimal#clone is deprecated/) do
-      BigDecimal(0).clone
+    assert_warning(/^$/) do
+      x = BigDecimal(0)
+      assert_same(x, x.clone)
     end
   end
 
   def test_dup
-    assert_warning(/BigDecimal#dup is deprecated/) do
+    assert_warning(/^$/) do
       [1, -1, 2**100, -2**100].each do |i|
         x = BigDecimal(i)
-        assert_equal(x, x.dup)
+        assert_same(x, x.dup)
       end
     end
   end
 
   def test_dup_subclass
-    assert_warning(/BigDecimal#dup is deprecated/) do
+    assert_warning(/BigDecimal\.new is deprecated/) do
       c = Class.new(BigDecimal)
       x = c.new(1)
       y = x.dup
+      assert_same(x, y)
       assert_equal(1, y)
       assert_kind_of(c, y)
     end

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

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