From 1c279a7d2753949c725754e1302f791b76358114 Mon Sep 17 00:00:00 2001 From: drbrain Date: Tue, 27 Nov 2012 04:28:14 +0000 Subject: * 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 --- test/rdoc/test_rdoc_code_object.rb | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'test/rdoc/test_rdoc_code_object.rb') 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 -- cgit v1.2.3