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

ruby-changes:30036

From: nagachika <ko1@a...>
Date: Sat, 20 Jul 2013 23:22:35 +0900 (JST)
Subject: [ruby-changes:30036] nagachika:r42088 (ruby_2_0_0): merge revision(s) 41466:

nagachika	2013-07-20 23:22:24 +0900 (Sat, 20 Jul 2013)

  New Revision: 42088

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42088

  Log:
    merge revision(s) 41466:
    
    envutil.rb: keyword arguments
    
    * test/ruby/envutil.rb (invoke_ruby, assert_normal_exit),
      (assert_in_out_err, assert_ruby_status, assert_separately): use
      keyword arguments so that optional parameters can be omitted.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/test/ruby/envutil.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 42087)
+++ ruby_2_0_0/version.h	(revision 42088)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-07-14"
-#define RUBY_PATCHLEVEL 270
+#define RUBY_RELEASE_DATE "2013-07-20"
+#define RUBY_PATCHLEVEL 271
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 14
+#define RUBY_RELEASE_DAY 20
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/envutil.rb
===================================================================
--- ruby_2_0_0/test/ruby/envutil.rb	(revision 42087)
+++ ruby_2_0_0/test/ruby/envutil.rb	(revision 42088)
@@ -31,20 +31,18 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L31
 
   LANG_ENVS = %w"LANG LC_ALL LC_CTYPE"
 
-  def invoke_ruby(args, stdin_data="", capture_stdout=false, capture_stderr=false, opt={})
+  def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr = false,
+                  encoding: nil, timeout: 10, reprieve: 1, **opt)
     in_c, in_p = IO.pipe
     out_p, out_c = IO.pipe if capture_stdout
     err_p, err_c = IO.pipe if capture_stderr && capture_stderr != :merge_to_stdout
-    opt = opt.dup
     opt[:in] = in_c
     opt[:out] = out_c if capture_stdout
     opt[:err] = capture_stderr == :merge_to_stdout ? out_c : err_c if capture_stderr
-    if enc = opt.delete(:encoding)
-      out_p.set_encoding(enc) if out_p
-      err_p.set_encoding(enc) if err_p
+    if encoding
+      out_p.set_encoding(encoding) if out_p
+      err_p.set_encoding(encoding) if err_p
     end
-    timeout = opt.delete(:timeout) || 10
-    reprieve = opt.delete(:reprieve) || 1
     c = "C"
     child_env = {}
     LANG_ENVS.each {|lc| child_env[lc] = c}
@@ -52,7 +50,7 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L50
       child_env.update(args.shift)
     end
     args = [args] if args.kind_of?(String)
-    pid = spawn(child_env, EnvUtil.rubybin, *args, opt)
+    pid = spawn(child_env, EnvUtil.rubybin, *args, **opt)
     in_c.close
     out_c.close if capture_stdout
     err_c.close if capture_stderr && capture_stderr != :merge_to_stdout
@@ -204,11 +202,10 @@ module Test https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L202
         $VERBOSE = verbose
       end
 
-      def assert_normal_exit(testsrc, message = '', opt = {})
+      def assert_normal_exit(testsrc, message = '', child_env: nil, **opt)
         assert_valid_syntax(testsrc, caller_locations(1, 1)[0])
-        if opt.include?(:child_env)
-          opt = opt.dup
-          child_env = [opt.delete(:child_env)] || []
+        if child_env
+          child_env = [child_env]
         else
           child_env = []
         end
@@ -242,7 +239,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L239
         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, **opt)
         stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, opt)
         if block_given?
           raise "test_stdout ignored, use block only or without block" if test_stdout != []
@@ -267,7 +264,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L264
         end
       end
 
-      def assert_ruby_status(args, test_stdin="", message=nil, opt={})
+      def assert_ruby_status(args, test_stdin="", message=nil, **opt)
         out, _, status = EnvUtil.invoke_ruby(args, test_stdin, true, :merge_to_stdout, opt)
         message ||= "ruby exit status is not success:"
         assert(status.success?, FailDesc[status, message, out])
@@ -275,7 +272,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L272
 
       ABORT_SIGNALS = Signal.list.values_at(*%w"ILL ABRT BUS SEGV")
 
-      def assert_separately(args, file = nil, line = nil, src, **opt)
+      def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **opt)
         unless file and line
           loc, = caller_locations(1,1)
           file ||= loc.path
@@ -292,7 +289,6 @@ module Test https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L289
 eom
         args = args.dup
         $:.each{|l| args.unshift "-I#{l}" }
-        ignore_stderr = opt.delete(:ignore_stderr)
         stdout, stderr, status = EnvUtil.invoke_ruby(args, src, true, true, opt)
         abort = status.coredump? || (status.signaled? && ABORT_SIGNALS.include?(status.termsig))
         assert(!abort, FailDesc[status, stderr])

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r41466


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

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