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

ruby-changes:52293

From: eregon <ko1@a...>
Date: Wed, 22 Aug 2018 07:01:37 +0900 (JST)
Subject: [ruby-changes:52293] eregon:r64501 (trunk): Update to ruby/spec@dd828d6

eregon	2018-08-22 07:01:34 +0900 (Wed, 22 Aug 2018)

  New Revision: 64501

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

  Log:
    Update to ruby/spec@dd828d6

  Modified files:
    trunk/spec/ruby/.rubocop.yml
    trunk/spec/ruby/.rubocop_todo.yml
    trunk/spec/ruby/language/block_spec.rb
    trunk/spec/ruby/language/method_spec.rb
    trunk/spec/ruby/optional/capi/README
    trunk/spec/ruby/optional/capi/spec_helper.rb
Index: spec/ruby/.rubocop.yml
===================================================================
--- spec/ruby/.rubocop.yml	(revision 64500)
+++ spec/ruby/.rubocop.yml	(revision 64501)
@@ -37,6 +37,9 @@ Lint/LiteralAsCondition: https://github.com/ruby/ruby/blob/trunk/spec/ruby/.rubocop.yml#L37
 Lint/UnneededRequireStatement:
   Enabled: false
 
+Lint/UnneededSplatExpansion:
+  Enabled: false
+
 Lint/UnifiedInteger:
   Enabled: false
 
@@ -52,7 +55,6 @@ Lint/UselessAssignment: https://github.com/ruby/ruby/blob/trunk/spec/ruby/.rubocop.yml#L55
 Lint/UselessComparison:
   Enabled: false
 
-# The cop registers too many false positives to `.should == something`
 Lint/Void:
   Enabled: false
 
@@ -65,11 +67,32 @@ Lint/EmptyWhen: https://github.com/ruby/ruby/blob/trunk/spec/ruby/.rubocop.yml#L67
     - language/case_spec.rb
     - optional/capi/spec_helper.rb
 
+Lint/FormatParameterMismatch:
+  Exclude:
+    - 'core/kernel/shared/sprintf.rb'
+    - 'core/string/modulo_spec.rb'
+
 Lint/NestedMethodDefinition:
   Exclude:
     - language/def_spec.rb
     - language/fixtures/def.rb
 
+Lint/UnreachableCode:
+  Exclude:
+    - 'core/enumerator/lazy/fixtures/classes.rb'
+    - 'core/kernel/catch_spec.rb'
+    - 'core/kernel/throw_spec.rb'
+    - 'language/break_spec.rb'
+    - 'language/fixtures/break.rb'
+    - 'language/fixtures/break_lambda_toplevel.rb'
+    - 'language/fixtures/break_lambda_toplevel_block.rb'
+    - 'language/fixtures/break_lambda_toplevel_method.rb'
+    - 'language/fixtures/return.rb'
+    - 'language/next_spec.rb'
+    - 'language/return_spec.rb'
+    - 'optional/capi/kernel_spec.rb'
+    - 'shared/kernel/raise.rb'
+
 Lint/UriRegexp:
   Exclude:
     - 'library/uri/regexp_spec.rb'
Index: spec/ruby/.rubocop_todo.yml
===================================================================
--- spec/ruby/.rubocop_todo.yml	(revision 64500)
+++ spec/ruby/.rubocop_todo.yml	(revision 64501)
@@ -32,12 +32,6 @@ Lint/FloatOutOfRange: https://github.com/ruby/ruby/blob/trunk/spec/ruby/.rubocop_todo.yml#L32
   Exclude:
     - 'core/string/modulo_spec.rb'
 
-# Offense count: 107
-Lint/FormatParameterMismatch:
-  Exclude:
-    - 'core/kernel/shared/sprintf.rb'
-    - 'core/string/modulo_spec.rb'
-
 # Offense count: 29
 Lint/HandleExceptions:
   Enabled: false
@@ -148,42 +142,6 @@ Lint/UnderscorePrefixedVariableName: https://github.com/ruby/ruby/blob/trunk/spec/ruby/.rubocop_todo.yml#L142
     - 'core/io/popen_spec.rb'
     - 'language/block_spec.rb'
 
-# Offense count: 90
-# Cop supports --auto-correct.
-Lint/UnneededSplatExpansion:
-  Exclude:
-    - 'core/array/element_reference_spec.rb'
-    - 'core/enumerable/fixtures/classes.rb'
-    - 'core/enumerable/max_by_spec.rb'
-    - 'core/enumerable/min_by_spec.rb'
-    - 'core/enumerable/minmax_by_spec.rb'
-    - 'core/enumerator/lazy/fixtures/classes.rb'
-    - 'core/file/basename_spec.rb'
-    - 'core/kernel/p_spec.rb'
-    - 'language/array_spec.rb'
-    - 'language/break_spec.rb'
-    - 'language/case_spec.rb'
-    - 'language/next_spec.rb'
-    - 'language/send_spec.rb'
-    - 'language/variables_spec.rb'
-
-# Offense count: 54
-Lint/UnreachableCode:
-  Exclude:
-    - 'core/enumerator/lazy/fixtures/classes.rb'
-    - 'core/kernel/catch_spec.rb'
-    - 'core/kernel/throw_spec.rb'
-    - 'language/break_spec.rb'
-    - 'language/fixtures/break.rb'
-    - 'language/fixtures/break_lambda_toplevel.rb'
-    - 'language/fixtures/break_lambda_toplevel_block.rb'
-    - 'language/fixtures/break_lambda_toplevel_method.rb'
-    - 'language/fixtures/return.rb'
-    - 'language/next_spec.rb'
-    - 'language/return_spec.rb'
-    - 'optional/capi/kernel_spec.rb'
-    - 'shared/kernel/raise.rb'
-
 # Offense count: 7
 # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
 Lint/UselessAccessModifier:
Index: spec/ruby/language/method_spec.rb
===================================================================
--- spec/ruby/language/method_spec.rb	(revision 64500)
+++ spec/ruby/language/method_spec.rb	(revision 64501)
@@ -512,6 +512,15 @@ describe "A method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L512
     end
 
     evaluate <<-ruby do
+        def m() end
+      ruby
+
+      m().should be_nil
+      m(*[]).should be_nil
+      m(**{}).should be_nil
+    end
+
+    evaluate <<-ruby do
         def m(*) end
       ruby
 
@@ -527,6 +536,8 @@ describe "A method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L536
       m().should == []
       m(1).should == [1]
       m(1, 2, 3).should == [1, 2, 3]
+      m(*[]).should == []
+      m(**{}).should == []
     end
 
     evaluate <<-ruby do
@@ -561,6 +572,8 @@ describe "A method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L572
 
       m().should == {}
       m(a: 1, b: 2).should == { a: 1, b: 2 }
+      m(*[]).should == {}
+      m(**{}).should == {}
       lambda { m(2) }.should raise_error(ArgumentError)
     end
 
Index: spec/ruby/language/block_spec.rb
===================================================================
--- spec/ruby/language/block_spec.rb	(revision 64500)
+++ spec/ruby/language/block_spec.rb	(revision 64501)
@@ -57,7 +57,7 @@ describe "A block yielded a single" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/block_spec.rb#L57
       result.should == [{"a" => 1, "b" => 2}, {}]
     end
 
-    describe("when non-symbol keys are in a keyword arguments Hash") do
+    describe "when non-symbol keys are in a keyword arguments Hash" do
       ruby_version_is ""..."2.6" do
         it "separates non-symbol keys and symbol keys" do
           result = m(["a" => 10, b: 2]) { |a=nil, **b| [a, b] }
Index: spec/ruby/optional/capi/spec_helper.rb
===================================================================
--- spec/ruby/optional/capi/spec_helper.rb	(revision 64500)
+++ spec/ruby/optional/capi/spec_helper.rb	(revision 64501)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L1
-require_relative '../../spec_helper'
+# Require the main spec_helper.rb at the end to let `ruby ...spec.rb` work
 
 # MRI magic to use built but not installed ruby
 $extmk = false
@@ -6,13 +6,9 @@ $extmk = false https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L6
 require 'rbconfig'
 
 OBJDIR ||= File.expand_path("../../../ext/#{RUBY_ENGINE}/#{RUBY_VERSION}", __FILE__)
-mkdir_p(OBJDIR)
-
-def extension_path
-  File.expand_path("../ext", __FILE__)
-end
 
 def object_path
+  mkdir_p(OBJDIR)
   OBJDIR
 end
 
@@ -20,6 +16,7 @@ def compile_extension(name) https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L16
   debug = false
   run_mkmf_in_process = RUBY_ENGINE == 'truffleruby'
 
+  ext_dir = File.expand_path("../ext", __FILE__)
   ext = "#{name}_spec"
   lib = "#{object_path}/#{ext}.#{RbConfig::CONFIG['DLEXT']}"
   ruby_header = "#{RbConfig::CONFIG['rubyhdrdir']}/ruby.h"
@@ -31,8 +28,8 @@ def compile_extension(name) https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L28
     # not found, then compile
   else
     case # if lib is older than headers, source or libruby, then recompile
-    when mtime <= File.mtime("#{extension_path}/rubyspec.h")
-    when mtime <= File.mtime("#{extension_path}/#{ext}.c")
+    when mtime <= File.mtime("#{ext_dir}/rubyspec.h")
+    when mtime <= File.mtime("#{ext_dir}/#{ext}.c")
     when mtime <= File.mtime(ruby_header)
     when libruby_so && mtime <= File.mtime("#{RbConfig::CONFIG['libdir']}/#{libruby_so}")
     else
@@ -45,7 +42,7 @@ def compile_extension(name) https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L42
   Dir.mkdir(tmpdir)
   begin
     ["rubyspec.h", "#{ext}.c"].each do |file|
-      cp "#{extension_path}/#{file}", "#{tmpdir}/#{file}"
+      cp "#{ext_dir}/#{file}", "#{tmpdir}/#{file}"
     end
 
     Dir.chdir(tmpdir) do
@@ -108,8 +105,8 @@ end https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L105
 
 def load_extension(name)
   require compile_extension(name)
-rescue LoadError
-  if %r{/usr/sbin/execerror ruby "\(ld 3 1 main ([/a-zA-Z0-9_\-.]+_spec\.so)"} =~ $!.message
+rescue LoadError => e
+  if %r{/usr/sbin/execerror ruby "\(ld 3 1 main ([/a-zA-Z0-9_\-.]+_spec\.so)"} =~ e.message
     system('/usr/sbin/execerror', "#{RbConfig::CONFIG["bindir"]}/ruby", "(ld 3 1 main #{$1}")
   end
   raise
@@ -117,3 +114,7 @@ end https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/spec_helper.rb#L114
 
 # Constants
 CAPI_SIZEOF_LONG = [0].pack('l!').size
+
+# Require the main spec_helper.rb only here so load_extension() is defined
+# when running specs with `ruby ...spec.rb`
+require_relative '../../spec_helper'
Index: spec/ruby/optional/capi/README
===================================================================
--- spec/ruby/optional/capi/README	(revision 64500)
+++ spec/ruby/optional/capi/README	(revision 64501)
@@ -13,4 +13,4 @@ specs: https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/README#L13
 5.  Name the C functions 'array_spec_rb_ary_new'.
 6.  Wrap the code in the optional/capi/ext/array_spec.c in
     '#ifdef HAVE_RB_ARY_NEW'
-6.  Attach the C function to the class using the name 'rb_ary_new'
+7.  Attach the C function to the class using the name 'rb_ary_new'

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

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