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

ruby-changes:63956

From: Benoit <ko1@a...>
Date: Sat, 5 Dec 2020 19:42:09 +0900 (JST)
Subject: [ruby-changes:63956] 9dbb2bfd73 (master): Wrap SortedSet with `ruby_version_is ""..."3.0"`

https://git.ruby-lang.org/ruby.git/commit/?id=9dbb2bfd73

From 9dbb2bfd73e66106ec75fb9fff3ac38d85e40395 Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Sat, 5 Dec 2020 11:40:00 +0100
Subject: Wrap SortedSet with `ruby_version_is ""..."3.0"`

* Using $ spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.0"' spec/ruby/library/set/sortedset/**/*_spec.rb

diff --git a/spec/ruby/library/set/sortedset/add_spec.rb b/spec/ruby/library/set/sortedset/add_spec.rb
index 5f8bde0..4f3bb25 100644
--- a/spec/ruby/library/set/sortedset/add_spec.rb
+++ b/spec/ruby/library/set/sortedset/add_spec.rb
@@ -1,39 +1,42 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/add_spec.rb#L1
 require_relative '../../../spec_helper'
-require 'set'
-require_relative 'shared/add'
 
-describe "SortedSet#add" do
-  it_behaves_like :sorted_set_add, :add
+ruby_version_is ""..."3.0" do
+  require 'set'
+  require_relative 'shared/add'
 
-  it "takes only values which responds <=>" do
-    obj = mock('no_comparison_operator')
-    obj.stub!(:respond_to?).with(:<=>).and_return(false)
-    -> { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError)
-  end
+  describe "SortedSet#add" do
+    it_behaves_like :sorted_set_add, :add
 
-  it "raises on incompatible <=> comparison" do
-    # Use #to_a here as elements are sorted only when needed.
-    # Therefore the <=> incompatibility is only noticed on sorting.
-    -> { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError)
-  end
-end
+    it "takes only values which responds <=>" do
+      obj = mock('no_comparison_operator')
+      obj.stub!(:respond_to?).with(:<=>).and_return(false)
+      -> { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError)
+    end
 
-describe "SortedSet#add?" do
-  before :each do
-    @set = SortedSet.new
+    it "raises on incompatible <=> comparison" do
+      # Use #to_a here as elements are sorted only when needed.
+      # Therefore the <=> incompatibility is only noticed on sorting.
+      -> { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError)
+    end
   end
 
-  it "adds the passed Object to self" do
-    @set.add?("cat")
-    @set.should include("cat")
-  end
+  describe "SortedSet#add?" do
+    before :each do
+      @set = SortedSet.new
+    end
 
-  it "returns self when the Object has not yet been added to self" do
-    @set.add?("cat").should equal(@set)
-  end
+    it "adds the passed Object to self" do
+      @set.add?("cat")
+      @set.should include("cat")
+    end
+
+    it "returns self when the Object has not yet been added to self" do
+      @set.add?("cat").should equal(@set)
+    end
 
-  it "returns nil when the Object has already been added to self" do
-    @set.add?("cat")
-    @set.add?("cat").should be_nil
+    it "returns nil when the Object has already been added to self" do
+      @set.add?("cat")
+      @set.add?("cat").should be_nil
+    end
   end
 end
diff --git a/spec/ruby/library/set/sortedset/append_spec.rb b/spec/ruby/library/set/sortedset/append_spec.rb
index ebcceba..d72d70b 100644
--- a/spec/ruby/library/set/sortedset/append_spec.rb
+++ b/spec/ruby/library/set/sortedset/append_spec.rb
@@ -1,7 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/append_spec.rb#L1
 require_relative '../../../spec_helper'
-require 'set'
-require_relative 'shared/add'
 
-describe "SortedSet#<<" do
-  it_behaves_like :sorted_set_add, :<<
+ruby_version_is ""..."3.0" do
+  require 'set'
+  require_relative 'shared/add'
+
+  describe "SortedSet#<<" do
+    it_behaves_like :sorted_set_add, :<<
+  end
 end
diff --git a/spec/ruby/library/set/sortedset/case_equality_spec.rb b/spec/ruby/library/set/sortedset/case_equality_spec.rb
index 48e3735..d7c296b 100644
--- a/spec/ruby/library/set/sortedset/case_equality_spec.rb
+++ b/spec/ruby/library/set/sortedset/case_equality_spec.rb
@@ -1,7 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/case_equality_spec.rb#L1
 require_relative '../../../spec_helper'
-require_relative 'shared/include'
-require 'set'
 
-describe "SortedSet#===" do
-  it_behaves_like :sorted_set_include, :===
+ruby_version_is ""..."3.0" do
+  require_relative 'shared/include'
+  require 'set'
+
+  describe "SortedSet#===" do
+    it_behaves_like :sorted_set_include, :===
+  end
 end
diff --git a/spec/ruby/library/set/sortedset/classify_spec.rb b/spec/ruby/library/set/sortedset/classify_spec.rb
index 62b26d5..4011e58 100644
--- a/spec/ruby/library/set/sortedset/classify_spec.rb
+++ b/spec/ruby/library/set/sortedset/classify_spec.rb
@@ -1,27 +1,30 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/classify_spec.rb#L1
 require_relative '../../../spec_helper'
-require 'set'
 
-describe "SortedSet#classify" do
-  before :each do
-    @set = SortedSet["one", "two", "three", "four"]
-  end
+ruby_version_is ""..."3.0" do
+  require 'set'
 
-  it "yields each Object in self in sorted order" do
-    res = []
-    @set.classify { |x| res << x }
-    res.should == ["one", "two", "three", "four"].sort
-  end
+  describe "SortedSet#classify" do
+    before :each do
+      @set = SortedSet["one", "two", "three", "four"]
+    end
 
-  it "returns an Enumerator when passed no block" do
-    enum = @set.classify
-    enum.should be_an_instance_of(Enumerator)
+    it "yields each Object in self in sorted order" do
+      res = []
+      @set.classify { |x| res << x }
+      res.should == ["one", "two", "three", "four"].sort
+    end
 
-    classified = enum.each { |x| x.length }
-    classified.should == { 3 => SortedSet["one", "two"], 4 => SortedSet["four"], 5 => SortedSet["three"] }
-  end
+    it "returns an Enumerator when passed no block" do
+      enum = @set.classify
+      enum.should be_an_instance_of(Enumerator)
+
+      classified = enum.each { |x| x.length }
+      classified.should == { 3 => SortedSet["one", "two"], 4 => SortedSet["four"], 5 => SortedSet["three"] }
+    end
 
-  it "classifies the Objects in self based on the block's return value" do
-    classified = @set.classify { |x| x.length }
-    classified.should == { 3 => SortedSet["one", "two"], 4 => SortedSet["four"], 5 => SortedSet["three"] }
+    it "classifies the Objects in self based on the block's return value" do
+      classified = @set.classify { |x| x.length }
+      classified.should == { 3 => SortedSet["one", "two"], 4 => SortedSet["four"], 5 => SortedSet["three"] }
+    end
   end
 end
diff --git a/spec/ruby/library/set/sortedset/clear_spec.rb b/spec/ruby/library/set/sortedset/clear_spec.rb
index 11b5db2..879aa82 100644
--- a/spec/ruby/library/set/sortedset/clear_spec.rb
+++ b/spec/ruby/library/set/sortedset/clear_spec.rb
@@ -1,17 +1,20 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/clear_spec.rb#L1
 require_relative '../../../spec_helper'
-require 'set'
 
-describe "SortedSet#clear" do
-  before :each do
-    @set = SortedSet["one", "two", "three", "four"]
-  end
+ruby_version_is ""..."3.0" do
+  require 'set'
 
-  it "removes all elements from self" do
-    @set.clear
-    @set.should be_empty
-  end
+  describe "SortedSet#clear" do
+    before :each do
+      @set = SortedSet["one", "two", "three", "four"]
+    end
+
+    it "removes all elements from self" do
+      @set.clear
+      @set.should be_empty
+    end
 
-  it "returns self" do
-    @set.clear.should equal(@set)
+    it "returns self" do
+      @set.clear.should equal(@set)
+    end
   end
 end
diff --git a/spec/ruby/library/set/sortedset/collect_spec.rb b/spec/ruby/library/set/sortedset/collect_spec.rb
index 21ead4f..0674f0d 100644
--- a/spec/ruby/library/set/sortedset/collect_spec.rb
+++ b/spec/ruby/library/set/sortedset/collect_spec.rb
@@ -1,7 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/collect_spec.rb#L1
 require_relative '../../../spec_helper'
-require 'set'
-require_relative 'shared/collect'
 
-describe "SortedSet#collect!" do
-  it_behaves_like :sorted_set_collect_bang, :collect!
+ruby_version_is ""..."3.0" do
+  require 'set'
+  require_relative 'shared/collect'
+
+  describe "SortedSet#collect!" do
+    it_behaves_like :sorted_set_collect_bang, :collect!
+  end
 end
diff --git a/spec/ruby/library/set/sortedset/constructor_spec.rb b/spec/ruby/library/set/sortedset/constructor_spec.rb
index 953144d..31f30fd 100644
--- a/spec/ruby/library/set/sortedset/constructor_spec.rb
+++ b/spec/ruby/library/set/sortedset/constructor_spec.rb
@@ -1,15 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/constructor_spec.rb#L1
 require_relative '../../../spec_helper'
-require 'set'
 
-describe "SortedSet[]" do
-  it "returns a new SortedSet populated with the passed Objects" do
-    set = SortedSet[1, 2, 3]
+ruby_version_is ""..."3.0" do
+  require 'set'
 
-    set.instance_of?(SortedSet).should be_true
-    set.size.should eql(3)
+  describe "SortedSet[]" do
+    it "returns a new SortedSet populated with the passed Objects" do
+      set = SortedSet[1, 2, 3]
 
-    set.should include(1)
-    set.should include(2)
-    set.should include(3)
+      set.instance_of?(SortedSet).should be_true
+      set.size.should eql(3)
+
+      set.should include(1)
+      set.should include(2)
+      set.should include(3)
+    end
   end
 end
diff --git a/spec/ruby/library/set/sortedset/delete_if_spec.rb b/spec/ruby/library/set/sortedset/delete_if_spec.rb
index 1ff6893..787639a 100644
--- a/spec/ruby/library/set/sortedset/delete_if_spec.rb
+++ b/spec/ruby/library/set/sortedset/delete_if_spec.rb
@@ -1,38 +1,41 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/set/sortedset/delete_if_spec.rb#L1
 require_relative '../../../spec_helper'
-require 'set'
 
-describe "SortedSet#delete_if" do
-  before :each do
-    @set = SortedSet["one", "two", "three"]
-  end
+ruby_version_is ""..."3.0" do
+  require 'set'
 
-  it "yields each Object in self in sorted order" do
-    ret = []
-    @set.delete_if { |x| ret << x }
-   (... truncated)

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

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