Sha256: 7322d83d4d9e26e54b97968a6e15f8d483e40cff68196f5fc8b63f2400a84c23

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 Bytes

Contents

# coding: utf-8

require 'test/unit/helper'

describe 'Hash#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 = {:a => 'string', :b => Time.now}
    copied   = original.simple_deep_copy
    
    original.each do |k, v|
      v.wont_be_same_as copied[k]
    end
  end
  
  it 'should immutable objects at first node returns the raw' do
    original = {:a => nil, :b => 1, :c => 100, :d => :symbol}
    copied   = original.simple_deep_copy
    
    original.each do |k, v|
      v.must_be_same_as copied[k]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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