зеркало из https://github.com/github/ruby.git
Call deprecated method only inside assert_warning block
This commit is contained in:
Родитель
9cb58f1698
Коммит
51b2b605e7
|
@ -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
|
||||||
|
|
Загрузка…
Ссылка в новой задаче