Sha256: b42743965fa5150699712e2392e9702e5dd6abddfc6b618e2bc65ac7197e82f8

Contents?: true

Size: 575 Bytes

Versions: 15

Compression:

Stored size: 575 Bytes

Contents

describe "Array#-" do
  it "creates an array minus any items from other array" do
    ([] - [1, 2, 4]).should == []
    ([1, 2, 4] - []).should == [1, 2, 4]
    ([1, 2, 3, 4, 5] - [1, 2, 4]).should == [3, 5]
  end

  it "removes multiple items on the lhs equal to one on the rhs" do
    ([1, 1, 2, 2, 3, 3, 4, 5] - [1, 2, 4]).should == [3, 3, 5]
  end

  it "is not destructive" do
    a = [1, 2, 3]
    a - []
    a.should == [1, 2, 3]
    a - [1]
    a.should == [1, 2, 3]
    a - [1, 2, 3]
    a.should == [1, 2, 3]
    a - [:a, :b, :c]
    a.should == [1, 2, 3]
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
opal-0.3.41 spec/core/array/minus_spec.rb
opal-0.3.40 spec/core/array/minus_spec.rb
opal-0.3.39 spec/core/array/minus_spec.rb
opal-0.3.38 spec/core/array/minus_spec.rb
opal-0.3.37 spec/core/array/minus_spec.rb
opal-0.3.36 spec/core/array/minus_spec.rb
opal-0.3.35 spec/core/array/minus_spec.rb
opal-0.3.34 spec/core/array/minus_spec.rb
opal-0.3.33 spec/core/array/minus_spec.rb
opal-0.3.32 spec/core/array/minus_spec.rb
opal-0.3.31 spec/core/array/minus_spec.rb
opal-0.3.30 spec/core/array/minus_spec.rb
opal-0.3.29 spec/core/array/minus_spec.rb
opal-0.3.28 spec/core/array/minus_spec.rb
opal-0.3.27 spec/core/array/minus_spec.rb