Sha256: 114cdff909009a9966c9d470c1c79b7bec33fd6e28c996b38d7f3fdae7fc5530

Contents?: true

Size: 433 Bytes

Versions: 31

Compression:

Stored size: 433 Bytes

Contents

describe "Array#clone" do
  it "produces a shallow copy where the references are directly copied" do
    a = [mock('1'), mock('2')]
    b = a.clone
    b.first.object_id.should == a.first.object_id
    b.last.object_id.should == a.last.object_id
  end

  it "creates a new array containing all the elements of the original" do
    a = [1, 2, 3, 4]
    b = a.clone
    b.should == a
    b.object_id.should_not == a.object_id
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
opal-0.4.4 spec/rubyspec/core/array/clone_spec.rb
opal-0.4.3 spec/rubyspec/core/array/clone_spec.rb
opal-0.4.2 spec/rubyspec/core/array/clone_spec.rb
opal-0.4.1 spec/rubyspec/core/array/clone_spec.rb
opal-0.4.0 spec/rubyspec/core/array/clone_spec.rb
opal-0.3.44 spec/rubyspec/core/array/clone_spec.rb
opal-0.3.43 spec/rubyspec/core/array/clone_spec.rb
opal-0.3.42 spec/core/array/clone_spec.rb
opal-0.3.41 spec/core/array/clone_spec.rb
opal-0.3.40 spec/core/array/clone_spec.rb
opal-0.3.39 spec/core/array/clone_spec.rb
opal-0.3.38 spec/core/array/clone_spec.rb
opal-0.3.37 spec/core/array/clone_spec.rb
opal-0.3.36 spec/core/array/clone_spec.rb
opal-0.3.35 spec/core/array/clone_spec.rb
opal-0.3.34 spec/core/array/clone_spec.rb
opal-0.3.33 spec/core/array/clone_spec.rb
opal-0.3.32 spec/core/array/clone_spec.rb
opal-0.3.31 spec/core/array/clone_spec.rb
opal-0.3.30 spec/core/array/clone_spec.rb