1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Call deprecated method only inside assert_warning block

This commit is contained in:
Nobuyoshi Nakada 2019-06-30 22:49:10 +09:00
parent 9cb58f1698
commit 51b2b605e7
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -4,13 +4,11 @@ require 'cmath'
class TestCMath < Test::Unit::TestCase
def test_deprecated_method
orig = $VERBOSE
$VERBOSE = true
root = nil
assert_warning(/CMath#sqrt! is deprecated; use CMath#sqrt or Math#sqrt/) do
CMath.sqrt!(1)
root = CMath.sqrt!(1)
end
assert_equal CMath.sqrt(1), CMath.sqrt!(1)
$VERBOSE = orig
assert_equal CMath.sqrt(1), root
end
def test_sqrt