Sha256: 5e632604d1f2441e0d6ccacfde1bfb9b2544304397deffc056f3a3e52edf6a25

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

require 'test/unit'
require 'facet/module/attr'


# fixture

class C
  attr :a, :a=
  attr :b?, :b=
  attr :c, true
  attr :d, :e, true
end

# test

class TC_Attr < Test::Unit::TestCase

  def setup
    @c = C.new
  end

  def test_1
    assert_nothing_raised{ @c.a = 10 }
    assert_equal( 10, @c.a )
  end
  
  def test_2
    assert_nothing_raised{ @c.b = "1" }
    assert( @c.b? )
  end
  
  def test_3
    assert_nothing_raised{ @c.c = 20 }
    assert_equal( 20, @c.c )  
  end
  
  def test_4
    assert_nothing_raised{ @c.d = 30 }
    assert_equal( 30, @c.d )  
    assert_nothing_raised{ @c.e = 40 }
    assert_equal( 40, @c.e )    
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-0.7.0 test/tc_attr.rb
facets-0.7.1 test/tc_attr.rb
facets-0.7.2 test/tc_attr.rb