summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_parser_ruby.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-14 00:39:16 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-14 00:39:16 +0000
commit0b6da24a5e24ff9ce8e153d2f073c2363e94b28e (patch)
tree95eb233fee15aae2fa2ba7dbeb1bb9c7bdfd9e1d /test/rdoc/test_rdoc_parser_ruby.rb
parentfe89874540f5e95fbfd933a72fff2ad31b8e8d07 (diff)
* 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
Diffstat (limited to 'test/rdoc/test_rdoc_parser_ruby.rb')
-rw-r--r--test/rdoc/test_rdoc_parser_ruby.rb97
1 files changed, 97 insertions, 0 deletions
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