summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-30 22:49:10 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-07-01 00:22:39 +0900
commit51b2b605e78a160790c6d751b2907b836b39561c (patch)
treeeb6fcb66c2d0d0e4cef763157461190ef9311463
parent9cb58f1698b4a11af24d1129eb6b85d27e0a7145 (diff)
Call deprecated method only inside assert_warning block
-rw-r--r--test/test_cmath.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/test_cmath.rb b/test/test_cmath.rb
index b3692bc7cf..c603cd2bbe 100644
--- a/test/test_cmath.rb
+++ b/test/test_cmath.rb
@@ -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