diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-05 12:32:43 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-05 12:32:43 +0000 |
commit | 2c62030c5161386563c73028547588bd8de3b60a (patch) | |
tree | ab766dc1499e15c31d1d6c7dc95eb9fcd82462af /test | |
parent | 8d66627161fab5cc65dfb702e3285eb4fef221e8 (diff) |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_numeric.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb index ad5e283152..89e11d0ff8 100644 --- a/test/ruby/test_numeric.rb +++ b/test/ruby/test_numeric.rb @@ -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 |