diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-29 00:22:52 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-29 00:22:52 +0000 |
commit | 2076c2c3c401d9ab9324468818bbc46d4e4b870a (patch) | |
tree | 1697bf7d3f434e49cafd8a8c1579f2d065a7de56 /spec/ruby/core/array/difference_spec.rb | |
parent | 548defb608847973e78462a38c8418f90dce9911 (diff) | |
download | ruby-2076c2c3c401d9ab9324468818bbc46d4e4b870a.tar.gz |
Update to ruby/spec@944ea57
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/array/difference_spec.rb')
-rw-r--r-- | spec/ruby/core/array/difference_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/ruby/core/array/difference_spec.rb b/spec/ruby/core/array/difference_spec.rb new file mode 100644 index 0000000000..33ea8e1f3c --- /dev/null +++ b/spec/ruby/core/array/difference_spec.rb @@ -0,0 +1,24 @@ +require_relative '../../spec_helper' +require_relative 'fixtures/classes' +require_relative 'shared/difference' + +ruby_version_is "2.6" do + describe "Array#difference" do + it_behaves_like :array_binary_difference, :- + + it "returns a copy when called without any parameter" do + x = [1, 2, 3, 2] + x.difference.should == x + x.difference.should_not equal x + end + + it "does not return subclass instances for Array subclasses" do + ArraySpecs::MyArray[1, 2, 3].difference.should be_an_instance_of(Array) + end + + it "accepts multiple arguments" do + x = [1, 2, 3, 1] + x.difference([], [0, 1], [3, 4], [3]).should == [2] + end + end +end |