1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Import RDoc 3.1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2010-12-28 22:08:56 +00:00
parent 90d5bcf910
commit e2efe8e81d
28 changed files with 494 additions and 56 deletions

View file

@ -32,6 +32,66 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
@tempfile2.close
end
def test_extract_call_seq
m = RDoc::AnyMethod.new nil, 'm'
p = util_parser ''
comment = <<-COMMENT
# call-seq:
# bla => true or false
#
# moar comment
COMMENT
p.extract_call_seq comment, m
assert_equal "bla => true or false\n", m.call_seq
end
def test_extract_call_seq_blank
m = RDoc::AnyMethod.new nil, 'm'
p = util_parser ''
comment = <<-COMMENT
# call-seq:
# bla => true or false
#
COMMENT
p.extract_call_seq comment, m
assert_equal "bla => true or false\n", m.call_seq
end
def test_extract_call_seq_no_blank
m = RDoc::AnyMethod.new nil, 'm'
p = util_parser ''
comment = <<-COMMENT
# call-seq:
# bla => true or false
COMMENT
p.extract_call_seq comment, m
assert_equal "bla => true or false\n", m.call_seq
end
def test_extract_call_seq_undent
m = RDoc::AnyMethod.new nil, 'm'
p = util_parser ''
comment = <<-COMMENT
# call-seq:
# bla => true or false
# moar comment
COMMENT
p.extract_call_seq comment, m
assert_equal "bla => true or false\nmoar comment\n", m.call_seq
end
def test_get_symbol_or_name
util_parser "* & | + 5 / 4"
@ -503,6 +563,35 @@ end
assert_equal @top_level, blah.file
end
def test_parse_class_multi_ghost_methods
util_parser <<-'CLASS'
class Foo
##
# :method: one
#
# my method
##
# :method: two
#
# my method
[:one, :two].each do |t|
eval("def #{t}; \"#{t}\"; end")
end
end
CLASS
tk = @parser.get_tk
@parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, ''
foo = @top_level.classes.first
assert_equal 'Foo', foo.full_name
assert_equal 2, foo.method_list.length
end
def test_parse_class_nested_superclass
util_top_level
foo = @top_level.add_module RDoc::NormalModule, 'Foo'