diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-18 23:33:36 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-18 23:33:36 +0000 |
commit | df7dac9174a31e71b58be6184e23bfe6b742a494 (patch) | |
tree | 885edf624f0e8f37014b0d937340ac1c372a0066 /test/rdoc/test_rdoc_class_module.rb | |
parent | fed428007c015ac3b7f4586f2491517fafffa030 (diff) |
* lib/rdoc: Update to RDoc 4.1.0.preview.1
RDoc 4.1.0 contains a number of enhancements including a new default
style and accessibility support. You can see the changelog here:
https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
* test/rdoc: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_class_module.rb')
-rw-r--r-- | test/rdoc/test_rdoc_class_module.rb | 77 |
1 files changed, 62 insertions, 15 deletions
diff --git a/test/rdoc/test_rdoc_class_module.rb b/test/rdoc/test_rdoc_class_module.rb index ec81282c35..0e06587dc6 100644 --- a/test/rdoc/test_rdoc_class_module.rb +++ b/test/rdoc/test_rdoc_class_module.rb @@ -2,13 +2,6 @@ require File.expand_path '../xref_test_case', __FILE__ class TestRDocClassModule < XrefTestCase - def mu_pp obj - s = '' - s = PP.pp obj, s - s.force_encoding Encoding.default_external if defined? Encoding - s.chomp - end - def test_add_comment tl1 = @store.add_file 'one.rb' tl2 = @store.add_file 'two.rb' @@ -108,23 +101,23 @@ class TestRDocClassModule < XrefTestCase def test_documented_eh cm = RDoc::ClassModule.new 'C' - refute cm.documented? + refute cm.documented?, 'no comments, no markers' - cm.add_comment 'hi', @top_level + cm.add_comment '', @top_level - assert cm.documented? + refute cm.documented?, 'empty comment' - cm.comment.replace '' + cm.add_comment 'hi', @top_level - assert cm.documented? + assert cm.documented?, 'commented' cm.comment_location.clear - refute cm.documented? + refute cm.documented?, 'no comment' cm.document_self = nil # notify :nodoc: - assert cm.documented? + assert cm.documented?, ':nodoc:' end def test_each_ancestor @@ -165,6 +158,7 @@ class TestRDocClassModule < XrefTestCase ns = tl.add_module RDoc::NormalModule, 'Namespace' cm = ns.add_class RDoc::NormalClass, 'Klass', 'Super' + cm.document_self = true cm.record_location tl a1 = RDoc::Attr.new nil, 'a1', 'RW', '' @@ -236,6 +230,59 @@ class TestRDocClassModule < XrefTestCase assert_equal tl, loaded.method_list.first.file end + def test_marshal_dump_visibilty + @store.path = Dir.tmpdir + tl = @store.add_file 'file.rb' + + ns = tl.add_module RDoc::NormalModule, 'Namespace' + + cm = ns.add_class RDoc::NormalClass, 'Klass', 'Super' + cm.record_location tl + + a1 = RDoc::Attr.new nil, 'a1', 'RW', '' + a1.record_location tl + a1.document_self = false + + m1 = RDoc::AnyMethod.new nil, 'm1' + m1.record_location tl + m1.document_self = false + + c1 = RDoc::Constant.new 'C1', nil, '' + c1.record_location tl + c1.document_self = false + + i1 = RDoc::Include.new 'I1', '' + i1.record_location tl + i1.document_self = false + + e1 = RDoc::Extend.new 'E1', '' + e1.record_location tl + e1.document_self = false + + section_comment = RDoc::Comment.new('section comment') + section_comment.location = tl + + assert_equal 1, cm.sections.length, 'sanity, default section only' + + cm.add_attribute a1 + cm.add_method m1 + cm.add_constant c1 + cm.add_include i1 + cm.add_extend e1 + cm.add_comment 'this is a comment', tl + + loaded = Marshal.load Marshal.dump cm + loaded.store = @store + + assert_equal cm, loaded + + assert_empty loaded.attributes + assert_empty loaded.constants + assert_empty loaded.includes + assert_empty loaded.extends + assert_empty loaded.method_list + end + def test_marshal_load_version_0 tl = @store.add_file 'file.rb' ns = tl.add_module RDoc::NormalModule, 'Namespace' @@ -1401,7 +1448,7 @@ class TestRDocClassModule < XrefTestCase @c1.update_extends - assert_equal [a, c], @c1.extends + assert_equal [a, b, c], @c1.extends end def test_update_extends_trim |