From 0b6da24a5e24ff9ce8e153d2f073c2363e94b28e Mon Sep 17 00:00:00 2001 From: drbrain Date: Sat, 14 May 2011 00:39:16 +0000 Subject: * lib/rdoc.rb: Updated to RDoc 3.6 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rdoc/test_rdoc_parser_ruby.rb | 97 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) (limited to 'test/rdoc/test_rdoc_parser_ruby.rb') diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index ff1f1c9191..6c2b445ef3 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -1799,6 +1799,56 @@ EOF assert_equal :private, foo.visibility end + def test_parse_statements_identifier_public_class_method + content = <<-CONTENT +class Date + def self.now; end + private_class_method :now +end + +class DateTime < Date + public_class_method :now +end + CONTENT + + util_parser content + + @parser.parse_statements @top_level + + date, date_time = @top_level.classes + + date_now = date.method_list.first + date_time_now = date_time.method_list.first + + assert_equal :private, date_now.visibility + assert_equal :public, date_time_now.visibility + end + + def test_parse_statements_identifier_private_class_method + content = <<-CONTENT +class Date + def self.now; end + public_class_method :now +end + +class DateTime < Date + private_class_method :now +end + CONTENT + + util_parser content + + @parser.parse_statements @top_level + + date, date_time = @top_level.classes + + date_now = date.method_list.first + date_time_now = date_time.method_list.first + + assert_equal :public, date_now.visibility, date_now.full_name + assert_equal :private, date_time_now.visibility, date_time_now.full_name + end + def test_parse_statements_identifier_require content = "require 'bar'" @@ -1978,6 +2028,53 @@ end assert_equal 'm comment', m.comment end + def test_scan_block_comment_notflush + ## + # + # The previous test assumes that between the =begin/=end blocs that there is + # only one line, or minima formatting directives. This test tests for those + # who use the =begin bloc with longer / more advanced formatting within. + # + ## + content = <<-CONTENT +=begin rdoc + += DESCRIPTION + +This is a simple test class + += RUMPUS + +Is a silly word + +=end +class StevenSimpleClass + # A band on my iPhone as I wrote this test + FRUIT_BATS="Make nice music" + +=begin rdoc +A nice girl +=end + + def lauren + puts "Summoning Lauren!" + end +end + CONTENT + util_parser content + + @parser.scan + + foo = @top_level.classes.first + + assert_equal "= DESCRIPTION\n\nThis is a simple test class\n\n= RUMPUS\n\nIs a silly word", + foo.comment + + m = foo.method_list.first + + assert_equal 'A nice girl', m.comment + end + def test_scan_meta_method_block content = <<-CONTENT class C -- cgit v1.2.3