[前][次][番号順一覧][スレッド一覧]

ruby-changes:56303

From: Nobuyoshi <ko1@a...>
Date: Mon, 1 Jul 2019 00:23:20 +0900 (JST)
Subject: [ruby-changes:56303] Nobuyoshi Nakada: 51b2b605e7 (master): Call deprecated method only inside assert_warning block

https://git.ruby-lang.org/ruby.git/commit/?id=51b2b605e7

From 51b2b605e78a160790c6d751b2907b836b39561c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 30 Jun 2019 22:49:10 +0900
Subject: Call deprecated method only inside assert_warning block


diff --git a/test/test_cmath.rb b/test/test_cmath.rb
index b3692bc..c603cd2 100644
--- a/test/test_cmath.rb
+++ b/test/test_cmath.rb
@@ -4,13 +4,11 @@ require 'cmath' https://github.com/ruby/ruby/blob/trunk/test/test_cmath.rb#L4
 
 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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]