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

ruby-changes:65355

From: Benoit <ko1@a...>
Date: Sat, 27 Feb 2021 21:01:22 +0900 (JST)
Subject: [ruby-changes:65355] 36dde35e02 (master): Update to ruby/spec@37e52e5

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

From 36dde35e029c7a6607e6c674062ce6fc7a51c0bd Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Sat, 27 Feb 2021 13:00:26 +0100
Subject: Update to ruby/spec@37e52e5

---
 spec/ruby/core/array/drop_spec.rb                  |  13 ++
 spec/ruby/core/array/drop_while_spec.rb            |  13 ++
 spec/ruby/core/array/slice_spec.rb                 |  58 +++++++++
 spec/ruby/core/array/take_spec.rb                  |  13 ++
 spec/ruby/core/array/take_while_spec.rb            |  13 ++
 .../basicobject/singleton_method_added_spec.rb     |  59 +++++++++
 spec/ruby/core/dir/children_spec.rb                |  14 ++-
 spec/ruby/core/dir/each_child_spec.rb              |  12 ++
 spec/ruby/core/dir/entries_spec.rb                 |  13 +-
 spec/ruby/core/dir/foreach_spec.rb                 |  12 ++
 spec/ruby/core/enumerator/lazy/chunk_while_spec.rb |   5 +
 spec/ruby/core/enumerator/lazy/slice_after_spec.rb |   5 +
 .../ruby/core/enumerator/lazy/slice_before_spec.rb |   5 +
 spec/ruby/core/enumerator/lazy/slice_when_spec.rb  |   5 +
 spec/ruby/core/env/except_spec.rb                  |  36 ++++++
 spec/ruby/core/io/close_spec.rb                    |  43 +++++--
 spec/ruby/core/io/fixtures/classes.rb              |   3 +
 spec/ruby/core/kernel/fixtures/classes.rb          |  17 +--
 spec/ruby/core/kernel/public_send_spec.rb          |   8 ++
 spec/ruby/core/kernel/shared/method.rb             |   8 +-
 spec/ruby/core/kernel/shared/require.rb            |   8 +-
 spec/ruby/core/main/ruby2_keywords_spec.rb         |  11 ++
 spec/ruby/core/module/attr_accessor_spec.rb        |  15 ++-
 spec/ruby/core/module/attr_writer_spec.rb          |  12 +-
 spec/ruby/core/module/const_defined_spec.rb        |   5 +
 spec/ruby/core/module/const_get_spec.rb            |   8 ++
 spec/ruby/core/module/refine_spec.rb               |  39 +++++-
 spec/ruby/core/proc/shared/call.rb                 |   3 +
 spec/ruby/core/regexp/case_compare_spec.rb         |  10 ++
 spec/ruby/core/signal/trap_spec.rb                 |  14 +++
 spec/ruby/core/string/scrub_spec.rb                |  14 +++
 spec/ruby/core/time/shared/now.rb                  |  12 +-
 spec/ruby/fixtures/code/concurrent.rb              |   2 +-
 spec/ruby/language/regexp/back-references_spec.rb  |   5 +
 spec/ruby/language/regexp/empty_checks_spec.rb     | 135 +++++++++++++++++++++
 spec/ruby/language/regexp/repetition_spec.rb       |  11 ++
 spec/ruby/library/matrix/exponent_spec.rb          |   2 +-
 spec/ruby/library/set/initialize_spec.rb           |  25 ++++
 spec/ruby/optional/capi/exception_spec.rb          |  44 +++++++
 spec/ruby/optional/capi/ext/exception_spec.c       |   5 +
 spec/ruby/optional/capi/ext/io_spec.c              |  11 ++
 spec/ruby/optional/capi/ext/kernel_spec.c          |   5 -
 spec/ruby/optional/capi/ext/object_spec.c          |   7 +-
 spec/ruby/optional/capi/io_spec.rb                 |  26 ++++
 spec/ruby/optional/capi/kernel_spec.rb             |  14 ---
 spec/ruby/optional/capi/module_spec.rb             |  23 ++++
 spec/ruby/optional/capi/object_spec.rb             |  14 +++
 spec/ruby/optional/capi/thread_spec.rb             |  42 ++++++-
 48 files changed, 812 insertions(+), 65 deletions(-)
 create mode 100644 spec/ruby/core/env/except_spec.rb
 create mode 100644 spec/ruby/core/main/ruby2_keywords_spec.rb
 create mode 100644 spec/ruby/language/regexp/empty_checks_spec.rb

diff --git a/spec/ruby/core/array/drop_spec.rb b/spec/ruby/core/array/drop_spec.rb
index 84ea86b..f911fd9 100644
--- a/spec/ruby/core/array/drop_spec.rb
+++ b/spec/ruby/core/array/drop_spec.rb
@@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/drop_spec.rb#L1
 require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
 
 describe "Array#drop" do
   it "removes the specified number of elements from the start of the array" do
@@ -48,4 +49,16 @@ describe "Array#drop" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/drop_spec.rb#L49
 
     -> { [1, 2].drop(obj) }.should raise_error(TypeError)
   end
+
+  ruby_version_is ''...'3.0' do
+    it 'returns a subclass instance for Array subclasses' do
+      ArraySpecs::MyArray[1, 2, 3, 4, 5].drop(1).should be_an_instance_of(ArraySpecs::MyArray)
+    end
+  end
+
+  ruby_version_is '3.0' do
+    it 'returns a Array instance for Array subclasses' do
+      ArraySpecs::MyArray[1, 2, 3, 4, 5].drop(1).should be_an_instance_of(Array)
+    end
+  end
 end
diff --git a/spec/ruby/core/array/drop_while_spec.rb b/spec/ruby/core/array/drop_while_spec.rb
index cfb6b1e..bb783d2 100644
--- a/spec/ruby/core/array/drop_while_spec.rb
+++ b/spec/ruby/core/array/drop_while_spec.rb
@@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/drop_while_spec.rb#L1
 require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
 
 describe "Array#drop_while" do
   it "removes elements from the start of the array while the block evaluates to true" do
@@ -12,4 +13,16 @@ describe "Array#drop_while" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/drop_while_spec.rb#L13
   it "removes elements from the start of the array until the block returns false" do
     [1, 2, 3, false, 5].drop_while { |n| n }.should == [false, 5]
   end
+
+  ruby_version_is ''...'3.0' do
+    it 'returns a subclass instance for Array subclasses' do
+      ArraySpecs::MyArray[1, 2, 3, 4, 5].drop_while { |n| n < 4 }.should be_an_instance_of(ArraySpecs::MyArray)
+    end
+  end
+
+  ruby_version_is '3.0' do
+    it 'returns a Array instance for Array subclasses' do
+      ArraySpecs::MyArray[1, 2, 3, 4, 5].drop_while { |n| n < 4 }.should be_an_instance_of(Array)
+    end
+  end
 end
diff --git a/spec/ruby/core/array/slice_spec.rb b/spec/ruby/core/array/slice_spec.rb
index f416d8d..2f98df9 100644
--- a/spec/ruby/core/array/slice_spec.rb
+++ b/spec/ruby/core/array/slice_spec.rb
@@ -185,6 +185,64 @@ describe "Array#slice!" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/slice_spec.rb#L185
       a.should == [3, 4]
     end
   end
+
+  describe "with a subclass of Array" do
+    before :each do
+      @array = ArraySpecs::MyArray[1, 2, 3, 4, 5]
+    end
+
+    ruby_version_is ''...'3.0' do
+      it "returns a subclass instance with [n, m]" do
+        @array.slice!(0, 2).should be_an_instance_of(ArraySpecs::MyArray)
+      end
+
+      it "returns a subclass instance with [-n, m]" do
+        @array.slice!(-3, 2).should be_an_instance_of(ArraySpecs::MyArray)
+      end
+
+      it "returns a subclass instance with [n..m]" do
+        @array.slice!(1..3).should be_an_instance_of(ArraySpecs::MyArray)
+      end
+
+      it "returns a subclass instance with [n...m]" do
+        @array.slice!(1...3).should be_an_instance_of(ArraySpecs::MyArray)
+      end
+
+      it "returns a subclass instance with [-n..-m]" do
+        @array.slice!(-3..-1).should be_an_instance_of(ArraySpecs::MyArray)
+      end
+
+      it "returns a subclass instance with [-n...-m]" do
+        @array.slice!(-3...-1).should be_an_instance_of(ArraySpecs::MyArray)
+      end
+    end
+
+    ruby_version_is '3.0' do
+      it "returns a Array instance with [n, m]" do
+        @array.slice!(0, 2).should be_an_instance_of(Array)
+      end
+
+      it "returns a Array instance with [-n, m]" do
+        @array.slice!(-3, 2).should be_an_instance_of(Array)
+      end
+
+      it "returns a Array instance with [n..m]" do
+        @array.slice!(1..3).should be_an_instance_of(Array)
+      end
+
+      it "returns a Array instance with [n...m]" do
+        @array.slice!(1...3).should be_an_instance_of(Array)
+      end
+
+      it "returns a Array instance with [-n..-m]" do
+        @array.slice!(-3..-1).should be_an_instance_of(Array)
+      end
+
+      it "returns a Array instance with [-n...-m]" do
+        @array.slice!(-3...-1).should be_an_instance_of(Array)
+      end
+    end
+  end
 end
 
 describe "Array#slice" do
diff --git a/spec/ruby/core/array/take_spec.rb b/spec/ruby/core/array/take_spec.rb
index 0de99b0..4fb6f0c 100644
--- a/spec/ruby/core/array/take_spec.rb
+++ b/spec/ruby/core/array/take_spec.rb
@@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/take_spec.rb#L1
 require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
 
 describe "Array#take" do
   it "returns the first specified number of elements" do
@@ -24,4 +25,16 @@ describe "Array#take" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/take_spec.rb#L25
   it "raises an ArgumentError when the argument is negative" do
     ->{ [1].take(-3) }.should raise_error(ArgumentError)
   end
+
+  ruby_version_is ''...'3.0' do
+    it 'returns a subclass instance for Array subclasses' do
+      ArraySpecs::MyArray[1, 2, 3, 4, 5].take(1).should be_an_instance_of(ArraySpecs::MyArray)
+    end
+  end
+
+  ruby_version_is '3.0' do
+    it 'returns a Array instance for Array subclasses' do
+      ArraySpecs::MyArray[1, 2, 3, 4, 5].take(1).should be_an_instance_of(Array)
+    end
+  end
 end
diff --git a/spec/ruby/core/array/take_while_spec.rb b/spec/ruby/core/array/take_while_spec.rb
index f159e6f..363419b 100644
--- a/spec/ruby/core/array/take_while_spec.rb
+++ b/spec/ruby/core/array/take_while_spec.rb
@@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/take_while_spec.rb#L1
 require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
 
 describe "Array#take_while" do
   it "returns all elements until the block returns false" do
@@ -12,4 +13,16 @@ describe "Array#take_while" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/take_while_spec.rb#L13
   it "returns all elements until the block returns false" do
     [1, 2, false, 4].take_while{ |element| element }.should == [1, 2]
   end
+
+  ruby_version_is ''...'3.0' do
+    it 'returns a subclass instance for Array subclasses' do
+      ArraySpecs::MyArray[1, 2, 3, 4, 5].take_while { |n| n < (... truncated)

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

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