ruby-changes:63901
From: Hiroshi <ko1@a...>
Date: Fri, 4 Dec 2020 19:44:58 +0900 (JST)
Subject: [ruby-changes:63901] b06ffce4ae (master): SortedSet was removed at a3db08d7b6ff119223f77e3df00b4f6deac971e2
https://git.ruby-lang.org/ruby.git/commit/?id=b06ffce4ae From b06ffce4aef002dc47c3c5968181230e7ab8d7cc Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Fri, 4 Dec 2020 19:34:06 +0900 Subject: SortedSet was removed at a3db08d7b6ff119223f77e3df00b4f6deac971e2 diff --git a/spec/ruby/library/set/sortedset/add_spec.rb b/spec/ruby/library/set/sortedset/add_spec.rb deleted file mode 100644 index 5f8bde0..0000000 --- a/spec/ruby/library/set/sortedset/add_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' -require_relative 'shared/add' - -describe "SortedSet#add" do - it_behaves_like :sorted_set_add, :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 - - 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 - -describe "SortedSet#add?" do - before :each do - @set = SortedSet.new - 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 - end -end diff --git a/spec/ruby/library/set/sortedset/append_spec.rb b/spec/ruby/library/set/sortedset/append_spec.rb deleted file mode 100644 index ebcceba..0000000 --- a/spec/ruby/library/set/sortedset/append_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' -require_relative 'shared/add' - -describe "SortedSet#<<" do - it_behaves_like :sorted_set_add, :<< -end diff --git a/spec/ruby/library/set/sortedset/case_equality_spec.rb b/spec/ruby/library/set/sortedset/case_equality_spec.rb deleted file mode 100644 index 48e3735..0000000 --- a/spec/ruby/library/set/sortedset/case_equality_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require_relative 'shared/include' -require 'set' - -describe "SortedSet#===" do - it_behaves_like :sorted_set_include, :=== -end diff --git a/spec/ruby/library/set/sortedset/classify_spec.rb b/spec/ruby/library/set/sortedset/classify_spec.rb deleted file mode 100644 index 62b26d5..0000000 --- a/spec/ruby/library/set/sortedset/classify_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' - -describe "SortedSet#classify" do - before :each do - @set = SortedSet["one", "two", "three", "four"] - end - - it "yields each Object in self in sorted order" do - res = [] - @set.classify { |x| res << x } - res.should == ["one", "two", "three", "four"].sort - 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"] } - end -end diff --git a/spec/ruby/library/set/sortedset/clear_spec.rb b/spec/ruby/library/set/sortedset/clear_spec.rb deleted file mode 100644 index 11b5db2..0000000 --- a/spec/ruby/library/set/sortedset/clear_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' - -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) - end -end diff --git a/spec/ruby/library/set/sortedset/collect_spec.rb b/spec/ruby/library/set/sortedset/collect_spec.rb deleted file mode 100644 index 21ead4f..0000000 --- a/spec/ruby/library/set/sortedset/collect_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' -require_relative 'shared/collect' - -describe "SortedSet#collect!" do - it_behaves_like :sorted_set_collect_bang, :collect! -end diff --git a/spec/ruby/library/set/sortedset/constructor_spec.rb b/spec/ruby/library/set/sortedset/constructor_spec.rb deleted file mode 100644 index 953144d..0000000 --- a/spec/ruby/library/set/sortedset/constructor_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -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] - - 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 diff --git a/spec/ruby/library/set/sortedset/delete_if_spec.rb b/spec/ruby/library/set/sortedset/delete_if_spec.rb deleted file mode 100644 index 1ff6893..0000000 --- a/spec/ruby/library/set/sortedset/delete_if_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' - -describe "SortedSet#delete_if" do - before :each do - @set = SortedSet["one", "two", "three"] - end - - it "yields each Object in self in sorted order" do - ret = [] - @set.delete_if { |x| ret << x } - ret.should == ["one", "two", "three"].sort - end - - it "deletes every element from self for which the passed block returns true" do - @set.delete_if { |x| x.size == 3 } - @set.size.should eql(1) - - @set.should_not include("one") - @set.should_not include("two") - @set.should include("three") - end - - it "returns self" do - @set.delete_if { |x| x }.should equal(@set) - end - - it "returns an Enumerator when passed no block" do - enum = @set.delete_if - enum.should be_an_instance_of(Enumerator) - - enum.each { |x| x.size == 3 } - - @set.should_not include("one") - @set.should_not include("two") - @set.should include("three") - end -end diff --git a/spec/ruby/library/set/sortedset/delete_spec.rb b/spec/ruby/library/set/sortedset/delete_spec.rb deleted file mode 100644 index 71583c7..0000000 --- a/spec/ruby/library/set/sortedset/delete_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' - -describe "SortedSet#delete" do - before :each do - @set = SortedSet["a", "b", "c"] - end - - it "deletes the passed Object from self" do - @set.delete("a") - @set.should_not include("a") - end - - it "returns self" do - @set.delete("a").should equal(@set) - @set.delete("x").should equal(@set) - end -end - -describe "SortedSet#delete?" do - before :each do - @set = SortedSet["a", "b", "c"] - end - - it "deletes the passed Object from self" do - @set.delete?("a") - @set.should_not include("a") - end - - it "returns self when the passed Object is in self" do - @set.delete?("a").should equal(@set) - end - - it "returns nil when the passed Object is not in self" do - @set.delete?("x").should be_nil - end -end diff --git a/spec/ruby/library/set/sortedset/difference_spec.rb b/spec/ruby/library/set/sortedset/difference_spec.rb deleted file mode 100644 index c3d679a..0000000 --- a/spec/ruby/library/set/sortedset/difference_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' -require_relative 'shared/difference' - -describe "SortedSet#difference" do - it_behaves_like :sorted_set_difference, :difference -end diff --git a/spec/ruby/library/set/sortedset/divide_spec.rb b/spec/ruby/library/set/sortedset/divide_spec.rb deleted file mode 100644 index 4b2135a..0000000 --- a/spec/ruby/library/set/sortedset/divide_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -require_relative '../../../spec_helper' -require 'set' - -describe "SortedSet#divide" do - it "divides self into a set of subsets based on the blocks return values" do - set = SortedSet["one", "two", "three", "four", "five"].divide { |x| x.length } - set.map { |x| x.to_a }.to_a.sort.should == [["five", "four"], ["one", "two"], ["three"]] - end - - it "yields each Object in self in sorted order" do - ret = [] - SortedSet["one", "two", "three", "four", "five"].divide { |x| ret << x } - ret.should == ["one", "two", "three", "four", "five"].sort - end - - # BUG: Does not raise a LocalJumpError, but a NoMethodError - # - # it "raises a LocalJumpError when not passed a block" do - # lambda { SortedSet[1].divide }.should raise_error(LocalJumpError) - # end -end - -describe "SortedSet#divide when passed a block with an arity of 2" do - it "divides self into a set of subsets based on the blocks return values" do - set = SortedSet[1, 3, 4, 6, 9, 10, 11].divide { |x, y| (x - y).abs == 1 } - set.map { |x| x.to_a }.to_a.sort.should == [[1], [3, 4], [6], [9, 10, 11]] - end - - it "yields each two Objects to the block" do - ret = [] - SortedSet[1, 2].divide { |x, y| ret << [x, y] } - ret.should == [[1, 1], [1, 2], [2, 1], [2, 2]] - end -end diff --git a/spec/ruby/library/set/sortedset/each_spec.rb b/spec/ruby/library/set/sortedset/each_spec.rb deleted file (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/