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:
parent
9cb58f1698
commit
51b2b605e7
1 changed files with 3 additions and 5 deletions
|
@ -4,13 +4,11 @@ require 'cmath'
|
||||||
|
|
||||||
class TestCMath < Test::Unit::TestCase
|
class TestCMath < Test::Unit::TestCase
|
||||||
def test_deprecated_method
|
def test_deprecated_method
|
||||||
orig = $VERBOSE
|
root = nil
|
||||||
$VERBOSE = true
|
|
||||||
assert_warning(/CMath#sqrt! is deprecated; use CMath#sqrt or Math#sqrt/) do
|
assert_warning(/CMath#sqrt! is deprecated; use CMath#sqrt or Math#sqrt/) do
|
||||||
CMath.sqrt!(1)
|
root = CMath.sqrt!(1)
|
||||||
end
|
end
|
||||||
assert_equal CMath.sqrt(1), CMath.sqrt!(1)
|
assert_equal CMath.sqrt(1), root
|
||||||
$VERBOSE = orig
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sqrt
|
def test_sqrt
|
||||||
|
|
Loading…
Reference in a new issue