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

ruby-changes:56305

From: Nobuyoshi <ko1@a...>
Date: Mon, 1 Jul 2019 00:23:22 +0900 (JST)
Subject: [ruby-changes:56305] Nobuyoshi Nakada: f13fb814e0 (master): Return the result of the block given to assert_warning/assert_no_warning

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

From f13fb814e0343b5c09afe0c6d3114ee24b84d295 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 30 Jun 2019 22:49:56 +0900
Subject: Return the result of the block given to
 assert_warning/assert_no_warning


diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb
index da2fc59..169a3dc 100644
--- a/test/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -688,13 +688,15 @@ eom https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L688
       end
 
       def assert_warning(pat, msg = nil)
+        result = nil
         stderr = EnvUtil.with_default_internal(pat.encoding) {
           EnvUtil.verbose_warning {
-            yield
+            result = yield
           }
         }
         msg = message(msg) {diff pat, stderr}
         assert(pat === stderr, msg)
+        result
       end
 
       def assert_warn(*args)
@@ -702,13 +704,15 @@ eom https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L704
       end
 
       def assert_no_warning(pat, msg = nil)
+        result = nil
         stderr = EnvUtil.verbose_warning {
           EnvUtil.with_default_internal(pat.encoding) {
-            yield
+            result = yield
           }
         }
         msg = message(msg) {diff pat, stderr}
         refute(pat === stderr, msg)
+        result
       end
 
       def assert_no_memory_leak(args, prepare, code, message=nil, limit: 2.0, rss: false, **opt)
-- 
cgit v0.10.2


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

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