Sha256: a84324e58f904e6671154f02cf7c76f14b9ab336b3b6c553e5973f2b06f5ffd6

Contents?: true

Size: 976 Bytes

Versions: 57

Compression:

Stored size: 976 Bytes

Contents

describe "Array#&" do
  it "relies on Ruby's #hash (not JavaScript's #toString) for identifying array items" do
    a1 = [ 123, '123']
    a2 = ['123', 123 ]
    (a1 & a2).should == a1
    (a2 & a1).should == a2

    a1 = [ Time.at(1429521600.1), Time.at(1429521600.9) ]
    a2 = [ Time.at(1429521600.9), Time.at(1429521600.1) ]
    (a1 & a2).should == a1
    (a2 & a1).should == a2

    a1 = [ Object.new, Object.new ]
    a2 = [ Object.new, Object.new ]
    (a1 & a2).should == []
    (a2 & a1).should == []

    a1 = [ 1, 2, 3, '1', '2', '3']
    a2 = ['1', '2', '3', 1, 2, 3 ]
    (a1 & a2).should == a1
    (a2 & a1).should == a2

    a1 = [ [1, 2, 3], '1,2,3']
    a2 = ['1,2,3', [1, 2, 3] ]
    (a1 & a2).should == a1
    (a2 & a1).should == a2

    a1 = [ true, 'true']
    a2 = ['true', true ]
    (a1 & a2).should == a1
    (a2 & a1).should == a2

    a1 = [ false, 'false']
    a2 = ['false', false ]
    (a1 & a2).should == a1
    (a2 & a1).should == a2
  end
end

Version data entries

57 entries across 57 versions & 2 rubygems

Version Path
opal-1.8.3.rc1 spec/opal/core/array/intersection_spec.rb
opal-1.8.2 spec/opal/core/array/intersection_spec.rb
opal-1.8.1 spec/opal/core/array/intersection_spec.rb
opal-1.8.0 spec/opal/core/array/intersection_spec.rb
opal-1.8.0.beta1 spec/opal/core/array/intersection_spec.rb
opal-1.7.4 spec/opal/core/array/intersection_spec.rb
opal-1.8.0.alpha1 spec/opal/core/array/intersection_spec.rb
opal-1.7.3 spec/opal/core/array/intersection_spec.rb
opal-1.7.2 spec/opal/core/array/intersection_spec.rb
opal-1.7.1 spec/opal/core/array/intersection_spec.rb
opal-1.7.0 spec/opal/core/array/intersection_spec.rb
opal-1.7.0.rc1 spec/opal/core/array/intersection_spec.rb
opal-1.6.1 spec/opal/core/array/intersection_spec.rb
opal-1.6.0 spec/opal/core/array/intersection_spec.rb
opal-1.6.0.rc1 spec/opal/core/array/intersection_spec.rb
opal-1.6.0.alpha1 spec/opal/core/array/intersection_spec.rb
opal-1.5.1 spec/opal/core/array/intersection_spec.rb
opal-1.5.0 spec/opal/core/array/intersection_spec.rb
opal-1.5.0.rc1 spec/opal/core/array/intersection_spec.rb
opal-1.4.1 spec/opal/core/array/intersection_spec.rb