aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_code_object.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rdoc/test_rdoc_code_object.rb')
-rw-r--r--test/rdoc/test_rdoc_code_object.rb35
1 files changed, 31 insertions, 4 deletions
diff --git a/test/rdoc/test_rdoc_code_object.rb b/test/rdoc/test_rdoc_code_object.rb
index c7a37488cc..ef8a5df713 100644
--- a/test/rdoc/test_rdoc_code_object.rb
+++ b/test/rdoc/test_rdoc_code_object.rb
@@ -1,9 +1,6 @@
# coding: US-ASCII
-require 'rubygems'
-require 'minitest/autorun'
require File.expand_path '../xref_test_case', __FILE__
-require 'rdoc/code_object'
class TestRDocCodeObject < XrefTestCase
@@ -32,6 +29,16 @@ class TestRDocCodeObject < XrefTestCase
assert_equal 'I am a comment', @co.comment
end
+ def test_comment_equals_comment
+ @co.comment = comment ''
+
+ assert_equal '', @co.comment.text
+
+ @co.comment = comment 'I am a comment'
+
+ assert_equal 'I am a comment', @co.comment.text
+ end
+
def test_comment_equals_document
doc = RDoc::Markup::Document.new
@co.comment = doc
@@ -167,7 +174,7 @@ class TestRDocCodeObject < XrefTestCase
def test_file_name
assert_equal nil, @co.file_name
- @co.record_location RDoc::TopLevel.new 'lib/file.rb'
+ @co.record_location @store.add_file 'lib/file.rb'
assert_equal 'lib/file.rb', @co.file_name
end
@@ -256,6 +263,26 @@ class TestRDocCodeObject < XrefTestCase
refute @co.ignored?
end
+ def test_section
+ parent = RDoc::Context.new
+ section = parent.sections.first
+
+ @co.parent = parent
+ @co.instance_variable_set :@section, section
+
+ assert_equal section, @co.section
+
+ @co.instance_variable_set :@section, nil
+ @co.instance_variable_set :@section_title, nil
+
+ assert_equal section, @co.section
+
+ @co.instance_variable_set :@section, nil
+ @co.instance_variable_set :@section_title, 'new title'
+
+ assert_equal 'new title', @co.section.title
+ end
+
def test_start_doc
@co.document_self = false
@co.document_children = false