зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4ce02b7bae
Коммит
5a213ee2e2
|
@ -1,3 +1,11 @@
|
||||||
|
Sat Mar 19 18:32:00 2016 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
|
* 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@mrkn.jp>
|
Sat Mar 19 18:21:00 2016 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
* bignum.c (Bignum#<=>): remove it because they are unified with
|
* bignum.c (Bignum#<=>): remove it because they are unified with
|
||||||
|
|
|
@ -3799,7 +3799,7 @@ int_to_f(VALUE num)
|
||||||
val = rb_big2dbl(num);
|
val = rb_big2dbl(num);
|
||||||
}
|
}
|
||||||
else {
|
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);
|
return DBL2NUM(val);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require "-test-/integer"
|
||||||
|
|
||||||
class TestIntegerExt < Test::Unit::TestCase
|
class TestIntegerExt < Test::Unit::TestCase
|
||||||
def test_my_integer_to_f
|
def test_my_integer_to_f
|
||||||
assert_raise(TypeError) do
|
assert_raise(NotImplementedError) do
|
||||||
Bug::Integer::MyInteger.new.to_f
|
Bug::Integer::MyInteger.new.to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче