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

ruby-changes:44195

From: nobu <ko1@a...>
Date: Tue, 27 Sep 2016 17:35:36 +0900 (JST)
Subject: [ruby-changes:44195] nobu:r56267 (trunk): assertions.rb: success option

nobu	2016-09-27 17:35:30 +0900 (Tue, 27 Sep 2016)

  New Revision: 56267

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56267

  Log:
    assertions.rb: success option
    
    * test/lib/test/unit/assertions.rb (assert_in_out_err): add
      success option to check the exit status.

  Modified files:
    trunk/test/lib/test/unit/assertions.rb
Index: test/lib/test/unit/assertions.rb
===================================================================
--- test/lib/test/unit/assertions.rb	(revision 56266)
+++ test/lib/test/unit/assertions.rb	(revision 56267)
@@ -548,7 +548,8 @@ EOT https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L548
         faildesc
       end
 
-      def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, **opt)
+      def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil,
+                            success: nil, **opt)
         stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
         if signo = status.termsig
           EnvUtil.diagnostic_reports(Signal.signame(signo), EnvUtil.rubybin, status.pid, Time.now)
@@ -570,6 +571,15 @@ EOT https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/assertions.rb#L571
                 end
               end
             end
+            unless success.nil?
+              a.for("success?") do
+                if success
+                  assert_predicate(status, :success?)
+                else
+                  assert_not_predicate(status, :success?)
+                end
+              end
+            end
           end
           status
         end

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

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