mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
8d66627161
commit
2c62030c51
2 changed files with 17 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue