Sha256: 5bbacb692e6e21d5df5c61fe831ac7aaa4c8428c845f79b71c155045f0bf746b
Contents?: true
Size: 890 Bytes
Versions: 3
Compression:
Stored size: 890 Bytes
Contents
# Test for facets/module/cattr require 'facets/module/cattr.rb' require 'test/unit' class TCModule < Test::Unit::TestCase class MockObject def initialize @@a = 10 end def b ; @@b ; end end def test_cattr assert_nothing_raised { MockObject.class_eval { cattr :a } } t = MockObject.new assert_equal( 10, t.a ) end def test_cattr_reader assert_nothing_raised { MockObject.class_eval { cattr_reader :a } } t = MockObject.new assert_equal( 10, t.a ) end def test_cattr_writer assert_nothing_raised { MockObject.class_eval { cattr_writer :b } } t = MockObject.new t.b = 5 assert_equal( 5, t.b ) end def test_cattr_accessor assert_nothing_raised { MockObject.class_eval { cattr_accessor :c } } t = MockObject.new t.c = 50 assert_equal( 50, t.c ) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-2.2.0 | test/unit/module/test_cattr.rb |
facets-2.2.1 | test/unit/module/test_cattr.rb |
facets-2.3.0 | test/core/module/test_cattr.rb |