2010-04-01 03:45:16 -04:00
|
|
|
require 'rubygems'
|
|
|
|
require 'minitest/autorun'
|
|
|
|
require 'rdoc/rdoc'
|
|
|
|
|
|
|
|
class TestRDocAttr < MiniTest::Unit::TestCase
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@a = RDoc::Attr.new nil, 'attr', 'RW', ''
|
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def test_aref
|
|
|
|
m = RDoc::Attr.new nil, 'attr', 'RW', nil
|
|
|
|
|
|
|
|
assert_equal 'attribute-i-attr', m.aref
|
|
|
|
end
|
|
|
|
|
2010-04-10 02:36:13 -04:00
|
|
|
def test_arglists
|
|
|
|
assert_nil @a.arglists
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def test_block_params
|
|
|
|
assert_nil @a.block_params
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_call_seq
|
|
|
|
assert_nil @a.call_seq
|
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def test_definition
|
|
|
|
assert_equal 'attr_accessor', @a.definition
|
|
|
|
|
|
|
|
@a.rw = 'R'
|
|
|
|
|
|
|
|
assert_equal 'attr_reader', @a.definition
|
|
|
|
|
|
|
|
@a.rw = 'W'
|
|
|
|
|
|
|
|
assert_equal 'attr_writer', @a.definition
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def test_full_name
|
|
|
|
assert_equal '(unknown)#attr', @a.full_name
|
|
|
|
end
|
|
|
|
|
2010-04-10 02:36:13 -04:00
|
|
|
def test_params
|
|
|
|
assert_nil @a.params
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def test_singleton
|
|
|
|
refute @a.singleton
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_type
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal 'instance', @a.type
|
2010-04-01 03:45:16 -04:00
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
@a.singleton = true
|
|
|
|
assert_equal 'class', @a.type
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|