Sha256: 1787b3901dd12a2e784f23b3d412a32d0c0c0714598efdfb1c0d335fd9dd18da
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facets/core/kernel/to_data.rb # # Extracted Wed Aug 23 18:22:52 EDT 2006 # Unit Tools Reap Test Extractor # require 'facets/core/kernel/to_data.rb' class TestToData < Test::Unit::TestCase class X attr_accessor :a, :b, :c def initialize(a, b, c) @a, @b, @c = a, b, c end def ==( other ) return false if @a != other.a return false if @b != other.b return false if @c != other.c true end end def test_001 x = X.new( 1, 2, 3 ) assert_equal( { :a=>1, :b=>2, :c=>3 }, x.to_data ) end def test_002 x = X.new( 1, 2, [:a,:b] ) assert_equal( { :a=>1, :b=>2, :c=>[:a,:b] }, x.to_data ) end def test_003 x = X.new( 1, 2, 3 ) d = x.to_data x.a = 3 assert_equal( 3, x.a ) x.from_data(d) assert_equal( 1, x.a ) end def test_004 x = X.new( 1, 2, 3 ) d = x.to_data y = d.to_object assert_equal( x, y ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-1.7.30 | test/lib/facets/core/kernel/test_to_data.rb |