Sha256: 3d3115a470832ca4a5d7d23f79d0169ba78124b7c160f415dfdffba18e8fb146

Contents?: true

Size: 695 Bytes

Versions: 5

Compression:

Stored size: 695 Bytes

Contents

# coding: utf-8

require 'test/unit/helper'

describe 'Array#simple_deep_copy' do

  it 'should original not be same as copied' do
    original = []
    original.wont_be_same_as original.simple_deep_copy
  end
  
  it 'should not immutable elements at fist node has been cloned' do
    original = ['element', Time.now]
    copied   = original.simple_deep_copy
    
    original.each_with_index do |o, i|
      o.wont_be_same_as copied[i]
    end
  end
  
  it 'should immutable objects at first node returns the raw' do
    original = [nil, 1, 100, :symbol]
    copied   = original.simple_deep_copy
    
    original.each_with_index do |o, i|
      o.must_be_same_as copied[i]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thinreports-0.7.7 test/unit/core/ext/array_spec.rb
thinreports-0.7.6 test/unit/core/ext/array_spec.rb
thinreports-0.7.5 test/unit/core/ext/array_spec.rb
thinreports-0.7.0 test/unit/core/ext/array_spec.rb
thinreports-0.6.0.pre3 test/unit/core/ext/array_spec.rb