Sha256: 8cfc6c72ebda4faa57132ceba27ebeb06de69aac6377877948100295ba2568e4

Contents?: true

Size: 584 Bytes

Versions: 10

Compression:

Stored size: 584 Bytes

Contents

require 'facets/hash/op_push'
require 'test/unit'

class TC_Hash_Op < Test::Unit::TestCase

  def test_op_push_two_element_array
    h = {}
    a = [:b, 2]
    r = {:b => 2}
    assert_equal(h, h << a)
    assert_equal(r, h)
  end

  def test_op_push_hash
    h1 = {:a => 1}
    h2 = {:b => 2, :c => 3 }
    r = { :a => 1, :b => 2, :c => 3 }
    assert_equal(h1, h1 << h2)
    assert_equal(r, h1)
  end

  def test_shift_update
    a = { :a => 1, :b => 2, :c => 3 }
    b = { :a => 0, :d => 4 }
    e = { :a => 0, :b => 2, :c => 3, :d => 4 }
    assert_equal( e, a << b )
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/hash/test_op_push.rb
facets-2.8.3 test/core/hash/test_op_push.rb
facets-2.8.2 test/core/hash/test_op_push.rb
facets-2.8.1 test/core/hash/test_op_push.rb
facets-2.8.0 test/core/hash/test_op_push.rb
facets-2.7.0 test/core/hash/test_op_push.rb
facets-2.6.0 test/core/hash/test_op_push.rb
facets-2.5.1 test/core/hash/test_op_push.rb
facets-2.5.0 test/core/hash/test_op_push.rb
facets-2.5.2 test/core/hash/test_op_push.rb