Sha256: 46e5f3315d02830f19a4c3cc22816ac6e6d8cc70491b7964d33a20acc92fb6c8
Contents?: true
Size: 631 Bytes
Versions: 14
Compression:
Stored size: 631 Bytes
Contents
# Test facets/prototype.rb require 'facets/prototype.rb' require 'test/unit' class TestPrototypeKernel < Test::Unit::TestCase def test_new q = nil s = "Testing" assert_nothing_raised { q = s.new } assert_equal( s, q ) assert_not_equal( s.object_id, q.object_id ) end end class TestPrototype < Test::Unit::TestCase def setup @person = prototype do @name = '' @age = 0 @announce = fn { |x| "#{x}, #{name} is #{age}" } end @person.name = 'Tom' @person.age = 35 end def test_simple_case assert_equal( "Peter, Tom is 35", @person.announce['Peter']) end end
Version data entries
14 entries across 14 versions & 1 rubygems