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

ruby-changes:71533

From: Benoit <ko1@a...>
Date: Tue, 29 Mar 2022 00:48:04 +0900 (JST)
Subject: [ruby-changes:71533] 8db4f25bf4 (master): Update to ruby/spec@aaf998f

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

From 8db4f25bf4327f169902afd9ea8f4b03b65656f0 Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Mon, 28 Mar 2022 17:47:04 +0200
Subject: Update to ruby/spec@aaf998f

---
 spec/ruby/.mspec.constants                         |   2 +
 spec/ruby/README.md                                |   8 +-
 spec/ruby/core/array/pack/x_spec.rb                |   1 +
 spec/ruby/core/array/sample_spec.rb                |   8 +
 spec/ruby/core/dir/foreach_spec.rb                 |   7 +
 spec/ruby/core/enumerable/shared/inject.rb         |   7 +
 spec/ruby/core/enumerator/lazy/with_index_spec.rb  |   8 +
 spec/ruby/core/exception/full_message_spec.rb      |  40 ++-
 spec/ruby/core/exception/system_exit_spec.rb       |  42 +++
 spec/ruby/core/file/utime_spec.rb                  |   4 +
 spec/ruby/core/hash/ruby2_keywords_hash_spec.rb    |  14 +
 spec/ruby/core/hash/shared/to_s.rb                 |   5 +-
 spec/ruby/core/io/shared/readlines.rb              |   5 +
 .../core/kernel/define_singleton_method_spec.rb    |  15 +
 spec/ruby/core/math/sqrt_spec.rb                   |   4 +
 spec/ruby/core/module/const_get_spec.rb            |  14 +
 spec/ruby/core/module/ruby2_keywords_spec.rb       |  79 +++++-
 spec/ruby/core/proc/parameters_spec.rb             |   2 +-
 spec/ruby/core/random/rand_spec.rb                 |   5 +
 spec/ruby/core/string/append_spec.rb               |   5 +
 spec/ruby/core/string/comparison_spec.rb           |   4 +
 spec/ruby/core/string/lstrip_spec.rb               |   4 +-
 spec/ruby/core/string/rindex_spec.rb               |   6 +-
 spec/ruby/core/string/shared/eql.rb                |   4 +
 spec/ruby/core/string/split_spec.rb                |   7 +
 spec/ruby/core/string/strip_spec.rb                |   4 +-
 spec/ruby/core/struct/new_spec.rb                  |  17 +-
 spec/ruby/core/thread/shared/exit.rb               |  22 +-
 spec/ruby/fixtures/constants.rb                    |  10 +
 spec/ruby/language/keyword_arguments_spec.rb       | 307 +++++++++++++++++++++
 spec/ruby/library/logger/device/close_spec.rb      |   4 +-
 spec/ruby/library/logger/device/write_spec.rb      |   4 +-
 spec/ruby/optional/capi/class_spec.rb              |  24 +-
 spec/ruby/optional/capi/ext/class_spec.c           |  22 +-
 spec/ruby/optional/capi/ext/kernel_spec.c          |  27 +-
 spec/ruby/optional/capi/ext/symbol_spec.c          |  11 +
 spec/ruby/optional/capi/fixtures/class.rb          |  10 +
 spec/ruby/optional/capi/kernel_spec.rb             |  65 ++++-
 spec/ruby/optional/capi/symbol_spec.rb             |   8 +
 spec/ruby/shared/kernel/raise.rb                   |  34 ++-
 spec/ruby/shared/process/exit.rb                   |   6 +
 41 files changed, 820 insertions(+), 55 deletions(-)
 create mode 100644 spec/ruby/language/keyword_arguments_spec.rb

diff --git a/spec/ruby/.mspec.constants b/spec/ruby/.mspec.constants
index c070e35496..5dd477eb66 100644
--- a/spec/ruby/.mspec.constants
+++ b/spec/ruby/.mspec.constants
@@ -39,6 +39,8 @@ CodingUS_ASCII https://github.com/ruby/ruby/blob/trunk/spec/ruby/.mspec.constants#L39
 CodingUTF_8
 ComparisonTest
 ConstantSpecsIncludedModule
+ConstantSpecsTwo
+ConstantSpecsThree
 ConstantVisibility
 Coverage
 CoverageSpecs
diff --git a/spec/ruby/README.md b/spec/ruby/README.md
index e62ddc7dce..df98723c9b 100644
--- a/spec/ruby/README.md
+++ b/spec/ruby/README.md
@@ -18,13 +18,13 @@ Every example code has a textual description, which presents several advantages: https://github.com/ruby/ruby/blob/trunk/spec/ruby/README.md#L18
 
 The specs are written with syntax similar to RSpec 2.
 They are run with MSpec, the purpose-built framework for running the Ruby Spec Suite.
-For more information, see the [MSpec](http://github.com/ruby/mspec) project.
+For more information, see the [MSpec](https://github.com/ruby/mspec) project.
 
 The specs describe the [language syntax](language/), the [core library](core/), the [standard library](library/), the [C API for extensions](optional/capi) and the [command line flags](command_line/).
 The language specs are grouped by keyword while the core and standard library specs are grouped by class and method.
 
 ruby/spec is known to be tested in these implementations for every commit:
-* [MRI](http://rubyci.org/) on 30 platforms and 4 versions
+* [MRI](https://rubyci.org/) on 30 platforms and 4 versions
 * [JRuby](https://github.com/jruby/jruby/tree/master/spec/ruby) for both 1.7 and 9.x
 * [TruffleRuby](https://github.com/oracle/truffleruby/tree/master/spec/ruby)
 * [Opal](https://github.com/opal/opal/tree/master/spec)
@@ -70,7 +70,7 @@ Then move to it: https://github.com/ruby/ruby/blob/trunk/spec/ruby/README.md#L70
 
     $ cd spec
 
-Clone [MSpec](http://github.com/ruby/mspec):
+Clone [MSpec](https://github.com/ruby/mspec):
 
     $ git clone https://github.com/ruby/mspec.git ../mspec
 
@@ -152,5 +152,5 @@ This project was originally born from [Rubinius](https://github.com/rubinius/rub https://github.com/ruby/ruby/blob/trunk/spec/ruby/README.md#L152
 The revision history of these specs is available [here](https://github.com/ruby/spec/blob/2b886623/CHANGES.before-2008-05-10).
 These specs were later extracted to their own project, RubySpec, with a specific vision and principles.
 At the end of 2014, Brian Shirai, the creator of RubySpec, decided to [end RubySpec](http://rubinius.com/2014/12/31/matz-s-ruby-developers-don-t-use-rubyspec/).
-A couple months later, the different repositories were merged and [the project was revived](http://eregon.github.io/rubyspec/2015/07/29/rubyspec-is-reborn.html).
+A couple months later, the different repositories were merged and [the project was revived](https://eregon.github.io/rubyspec/2015/07/29/rubyspec-is-reborn.html).
 On 12 January 2016, the name was changed to "The Ruby Spec Suite" for clarity and to let the RubySpec ideology rest in peace.
diff --git a/spec/ruby/core/array/pack/x_spec.rb b/spec/ruby/core/array/pack/x_spec.rb
index a28dd0bf21..86c3ad1aa4 100644
--- a/spec/ruby/core/array/pack/x_spec.rb
+++ b/spec/ruby/core/array/pack/x_spec.rb
@@ -30,6 +30,7 @@ describe "Array#pack with format 'x'" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/pack/x_spec.rb#L30
 
   it "does not add a NULL byte when passed the '*' modifier" do
     [].pack("x*").should == ""
+    [1, 2].pack("Cx*C").should == "\x01\x02"
   end
 end
 
diff --git a/spec/ruby/core/array/sample_spec.rb b/spec/ruby/core/array/sample_spec.rb
index 565d7ff7f9..755b46f126 100644
--- a/spec/ruby/core/array/sample_spec.rb
+++ b/spec/ruby/core/array/sample_spec.rb
@@ -19,10 +19,18 @@ describe "Array#sample" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/sample_spec.rb#L19
     [].sample.should be_nil
   end
 
+  it "returns nil for an empty array when called without n and a Random is given" do
+    [].sample(random: Random.new(42)).should be_nil
+  end
+
   it "returns a single value when not passed a count" do
     [4].sample.should equal(4)
   end
 
+  it "returns a single value when not passed a count and a Random is given" do
+    [4].sample(random: Random.new(42)).should equal(4)
+  end
+
   it "returns an empty Array when passed zero" do
     [4].sample(0).should == []
   end
diff --git a/spec/ruby/core/dir/foreach_spec.rb b/spec/ruby/core/dir/foreach_spec.rb
index c3ddb27a84..85e8c61fd6 100644
--- a/spec/ruby/core/dir/foreach_spec.rb
+++ b/spec/ruby/core/dir/foreach_spec.rb
@@ -42,6 +42,13 @@ describe "Dir.foreach" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/dir/foreach_spec.rb#L42
   it "accepts an encoding keyword for the encoding of the entries" do
     dirs = Dir.foreach("#{DirSpecs.mock_dir}/deeply/nested", encoding: "utf-8").to_a.sort
     dirs.each {|dir| dir.encoding.should == Encoding::UTF_8}
+
+    dirs = Dir.foreach("#{DirSpecs.mock_dir}/deeply/nested", encoding: Encoding::UTF_16LE).to_a.sort
+    dirs.each {|dir| dir.encoding.should == Encoding::UTF_16LE}
+
+    Dir.foreach("#{DirSpecs.mock_dir}/deeply/nested", encoding: Encoding::UTF_16LE) do |f|
+      f.encoding.should == Encoding::UTF_16LE
+    end
   end
 
   ruby_version_is ""..."2.7" do
diff --git a/spec/ruby/core/enumerable/shared/inject.rb b/spec/ruby/core/enumerable/shared/inject.rb
index 12e0665dda..e59b82b02e 100644
--- a/spec/ruby/core/enumerable/shared/inject.rb
+++ b/spec/ruby/core/enumerable/shared/inject.rb
@@ -66,4 +66,11 @@ describe :enumerable_inject, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/enumerable/shared/inject.rb#L66
   it "returns nil when fails(legacy rubycon)" do
     EnumerableSpecs::EachDefiner.new().send(@method) {|acc,x| 999 }.should == nil
   end
+
+  ruby_bug '#18635', ''...'3.2' do
+    it "raises an ArgumentError when no parameters or block is given" do
+      -> { [1,2].send(@method) }.should raise_error(ArgumentError)
+      -> { {one: 1, two: 2}.send(@method) }.should raise_error(ArgumentError)
+    end
+  end
 end
diff --git a/spec/ruby/core/enumerator/lazy/with_index_spec.rb b/spec/ruby/core/enumerator/lazy/with_index_spec.rb
index 3a59ba4116..b6dbe554d9 100644
--- a/spec/ruby/core/enumerator/lazy/with_index_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/with_index_spec.rb
@@ -26,5 +26,13 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/enumerator/lazy/with_index_spec.rb#L26
       (0..Float::INFINITY).lazy.with_index { |i, idx| result << [i * 2, idx] }.first(3)
       result.should == [[0,0],[2,1],[4,2]]
     end
+
+    it "resets after a new call to each" do
+      enum = (0..2).lazy.with_index.map { |i, idx| [i, idx] }
+      result = []
+      enum.each { |i, idx| result << [i, idx] }
+      enum.each { |i, idx| result << [i, idx] }
+      result.should == [[0,0], [1,1], [2,2], [0,0], [1,1], [2,2]]
+    end
   end
 end
diff --git a/spec/ruby/core/exception/full_message_spec.rb b/spec/ruby/core/exception/full_message_spec.rb
index 4cece9ebf9..9757a2f407 100644
--- a/spec/ruby/core/exception/full_message_s (... truncated)

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

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