Sha256: 124e16b387bc915e0f0403261fcfd3c994b01c7a13388e6155d6d21aabf4d56a

Contents?: true

Size: 539 Bytes

Versions: 23

Compression:

Stored size: 539 Bytes

Contents

describe "Array#<<" do
  it "pushes the object onto the end of the array" do
    ([ 1, 2 ] << "c" << "d" << [ 3, 4 ]).should == [1, 2, "c", "d", [3, 4]]
  end

  it "returns self to allow chaining" do
    a = []
    b = a
    (a << 1).should == b
    (a << 2 << 3).should == b
  end

  it "correctly resizes the Array" do
    a = []
    a.size.should == 0
    a << :foo
    a.size.should == 1
    a << :bar << :baz
    a.size.should == 3

    a = [1, 2, 3]
    a.shift
    a.shift
    a.shift
    a << :foo
    a.should == [:foo]
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
opal-0.3.41 spec/core/array/append_spec.rb
opal-0.3.40 spec/core/array/append_spec.rb
opal-0.3.39 spec/core/array/append_spec.rb
opal-0.3.38 spec/core/array/append_spec.rb
opal-0.3.37 spec/core/array/append_spec.rb
opal-0.3.36 spec/core/array/append_spec.rb
opal-0.3.35 spec/core/array/append_spec.rb
opal-0.3.34 spec/core/array/append_spec.rb
opal-0.3.33 spec/core/array/append_spec.rb
opal-0.3.32 spec/core/array/append_spec.rb
opal-0.3.31 spec/core/array/append_spec.rb
opal-0.3.30 spec/core/array/append_spec.rb
opal-0.3.29 spec/core/array/append_spec.rb
opal-0.3.28 spec/core/array/append_spec.rb
opal-0.3.27 spec/core/array/append_spec.rb
opal-0.3.26 spec/core/array/append_spec.rb
opal-0.3.25 spec/core/array/append_spec.rb
opal-0.3.22 spec/core/array/append_spec.rb
opal-0.3.21 test/core/array/append_spec.rb
opal-0.3.20 test/core/array/append_spec.rb