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

ruby-changes:42118

From: mrkn <ko1@a...>
Date: Sat, 19 Mar 2016 18:43:40 +0900 (JST)
Subject: [ruby-changes:42118] mrkn:r54192 (trunk): * numeric.c (int_to_f): raise NotImplementedError when a receiver

mrkn	2016-03-19 18:43:35 +0900 (Sat, 19 Mar 2016)

  New Revision: 54192

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

  Log:
    * numeric.c (int_to_f): raise NotImplementedError when a receiver
      class is unknown.
    
    * test/-ext-/integer/test_my_integer.rb (test_my_integer_to_f): modify
      a test for the above change.

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c
    trunk/test/-ext-/integer/test_my_integer.rb
Index: numeric.c
===================================================================
--- numeric.c	(revision 54191)
+++ numeric.c	(revision 54192)
@@ -3799,7 +3799,7 @@ int_to_f(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3799
 	val = rb_big2dbl(num);
     }
     else {
-	rb_raise(rb_eTypeError, "Unknown subclass for to_f: %s", rb_obj_classname(num));
+	rb_raise(rb_eNotImpError, "Unknown subclass for to_f: %s", rb_obj_classname(num));
     }
 
     return DBL2NUM(val);
Index: test/-ext-/integer/test_my_integer.rb
===================================================================
--- test/-ext-/integer/test_my_integer.rb	(revision 54191)
+++ test/-ext-/integer/test_my_integer.rb	(revision 54192)
@@ -4,7 +4,7 @@ require "-test-/integer" https://github.com/ruby/ruby/blob/trunk/test/-ext-/integer/test_my_integer.rb#L4
 
 class TestIntegerExt < Test::Unit::TestCase
   def test_my_integer_to_f
-    assert_raise(TypeError) do
+    assert_raise(NotImplementedError) do
       Bug::Integer::MyInteger.new.to_f
     end
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54191)
+++ ChangeLog	(revision 54192)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Mar 19 18:32:00 2016  Kenta Murata  <mrkn@m...>
+
+	* numeric.c (int_to_f): raise NotImplementedError when a receiver
+	  class is unknown.
+
+	* test/-ext-/integer/test_my_integer.rb (test_my_integer_to_f): modify
+	  a test for the above change.
+
 Sat Mar 19 18:21:00 2016  Kenta Murata  <mrkn@m...>
 
 	* bignum.c (Bignum#<=>): remove it because they are unified with

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

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