Sha256: d24be96f281dd6e7ddc633e2e006a1cc23ab3f95a682a8a4b987368e09981f12

Contents?: true

Size: 998 Bytes

Versions: 1

Compression:

Stored size: 998 Bytes

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/core/kernel/set_with.rb
#
# Extracted Fri Feb 16 02:00:36 EST 2007
# Project.rb Test Extraction
#

require 'facets/core/kernel/set_with.rb'


  require 'test/unit'

  class TCKernel < Test::Unit::TestCase

    Customer = Struct.new( "Customer", :name, :address, :zip )

    def test_hash
      bob = Customer.new()
      x = { :name => "Bob Sawyer", :address => "123 Maple, Anytown NC", :zip => 12345 }
      bob.set_with(x)
      assert_equal(x[:name], bob.name)
      assert_equal(x[:address], bob.address)
      assert_equal(x[:zip], bob.zip)
    end

    def test_block
      bob = Customer.new()
      x = lambda {|s| s.name = "Bob Sawyer"; s.address = "123 Maple, Anytown NC"; s.zip = 12345 }
      bob.set_with(&x)
      assert_equal("Bob Sawyer", bob.name)
      assert_equal("123 Maple, Anytown NC", bob.address)
      assert_equal(12345, bob.zip)
    end

  end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-1.8.49 test/lib/facets/core/kernel/test_set_with.rb