diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 01:41:25 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 01:41:25 +0000 |
commit | d42d6e690e3f553b971322eae783ac6b0d4d9692 (patch) | |
tree | 2004bf4517ee7b81466c300cf30092e62e65467e /test/rdoc/test_rdoc_parser_ruby.rb | |
parent | 670c6e8ce9d4a12bb4832e10fab27365398649bf (diff) | |
download | ruby-d42d6e690e3f553b971322eae783ac6b0d4d9692.tar.gz |
* lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(313287)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_parser_ruby.rb')
-rw-r--r-- | test/rdoc/test_rdoc_parser_ruby.rb | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index 5306032b98..8750433ff1 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -63,6 +63,21 @@ class C; end assert_equal Encoding::CP852, comment.text.encoding end + def test_collect_first_comment_rd_hash + parser = util_parser <<-CONTENT +=begin +first +=end + +# second +class C; end + CONTENT + + comment = parser.collect_first_comment + + assert_equal RDoc::Comment.new("first\n\n", @top_level), comment + end + def test_get_class_or_module ctxt = RDoc::Context.new ctxt.store = @store @@ -773,7 +788,7 @@ end assert_equal 2, foo.method_list.length end - def test_parse_const_fail_w_meta_method + def test_parse_const_fail_w_meta util_parser <<-CLASS class ConstFailMeta ## @@ -795,27 +810,6 @@ end assert_equal 1, const_fail_meta.attributes.length end - def test_parse_const_third_party - util_parser <<-CLASS -class A - true if B::C - true if D::E::F -end - CLASS - - tk = @parser.get_tk - - @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment - - a = @top_level.classes.first - assert_equal 'A', a.full_name - - visible = @store.all_modules.reject { |mod| mod.suppressed? } - visible = visible.map { |mod| mod.full_name } - - assert_empty visible - end - def test_parse_class_nested_superclass foo = @top_level.add_module RDoc::NormalModule, 'Foo' @@ -3251,7 +3245,25 @@ end c_b = c.find_method_named 'b' assert_equal :private, c_b.visibility - refute c_b.singleton + assert c_b.singleton + end + + def test_singleton_method_via_eigenclass + util_parser <<-RUBY +class C + class << self + def a() end + end +end + RUBY + + @parser.scan + + c = @store.find_class_named 'C' + c_a = c.find_method_named 'a' + + assert_equal :public, c_a.visibility + assert c_a.singleton end def test_stopdoc_after_comment |