summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_code_object.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 04:28:14 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 04:28:14 +0000
commit1c279a7d2753949c725754e1302f791b76358114 (patch)
tree36aa3bdde250e564445eba5f2e25fcb96bcb6cef /test/rdoc/test_rdoc_code_object.rb
parentc72f0daa877808e4fa5018b3191ca09d4b97c03d (diff)
* lib/rdoc*: Updated to RDoc 4.0 (pre-release)
* bin/rdoc: ditto * test/rdoc: ditto * NEWS: Updated with RDoc 4.0 information git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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