зеркало из https://github.com/github/ruby.git
* test/ruby/test_numeric.rb (test_nonzero_p): added test for String#nonzero?
[fix GH-1187] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
8d66627161
Коммит
2c62030c51
|
@ -1,3 +1,8 @@
|
|||
Tue Jan 5 21:32:26 2016 Kuniaki IGARASHI <igaiga@gmail.com>
|
||||
|
||||
* test/ruby/test_numeric.rb (test_nonzero_p): added test for String#nonzero?
|
||||
[fix GH-1187]
|
||||
|
||||
Tue Jan 5 11:47:23 2016 Damir Gaynetdinov <damir.gaynetdinov@gmail.com>
|
||||
|
||||
* doc/marshal.rdoc: Clarify object references example, that the
|
||||
|
|
|
@ -147,6 +147,18 @@ class TestNumeric < Test::Unit::TestCase
|
|||
assert_predicate(a, :zero?)
|
||||
end
|
||||
|
||||
def test_nonzero_p
|
||||
a = Class.new(Numeric) do
|
||||
def zero?; true; end
|
||||
end.new
|
||||
assert_nil(a.nonzero?)
|
||||
|
||||
a = Class.new(Numeric) do
|
||||
def zero?; false; end
|
||||
end.new
|
||||
assert_equal(a, a.nonzero?)
|
||||
end
|
||||
|
||||
def test_positive_p
|
||||
a = Class.new(Numeric) do
|
||||
def >(x); true; end
|
||||
|
|
Загрузка…
Ссылка в новой задаче