Skip to content

Commit 76d7674

Browse files
committed
Improve documentation
1 parent 208af01 commit 76d7674

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

lib/rdoc/markup/text_formatter_test_case.rb

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
11
require 'rdoc/markup/formatter_test_case'
22

33
##
4-
# Test case for creating new RDoc::Markup formatters. See
5-
# test_rdoc_markup_to_*.rb for examples.
4+
# Test case for creating new RDoc::Markup formatters. See also
5+
# RDoc::Markup::FormatterTestCase
6+
#
7+
#
8+
# See test_rdoc_markup_to_rdoc.rb for a complete example.
9+
#
10+
# Example:
11+
#
12+
# class TestRDocMarkupToNewTextFormat < RDoc::Markup::TextFormatterTestCase
13+
#
14+
# add_visitor_tests
15+
# add_text_tests
16+
#
17+
# def setup
18+
# super
19+
#
20+
# @to = RDoc::Markup::ToNewTextFormat.new
21+
# end
22+
#
23+
# def accept_blank_line
24+
# assert_equal :junk, @to.res.join
25+
# end
26+
#
27+
# # ...
28+
#
29+
# end
630

731
class RDoc::Markup::TextFormatterTestCase < RDoc::Markup::FormatterTestCase
832

33+
##
34+
# Adds test cases to the calling TestCase.
35+
936
def self.add_text_tests
1037
self.class_eval do
1138

39+
##
40+
# Test case that calls <tt>@to.accept_heading</tt>
41+
1242
def test_accept_heading_indent
1343
@to.start_accepting
1444
@to.indent = 3
@@ -17,6 +47,9 @@ def test_accept_heading_indent
1747
accept_heading_indent
1848
end
1949

50+
##
51+
# Test case that calls <tt>@to.accept_rule</tt>
52+
2053
def test_accept_rule_indent
2154
@to.start_accepting
2255
@to.indent = 3
@@ -25,6 +58,9 @@ def test_accept_rule_indent
2558
accept_rule_indent
2659
end
2760

61+
##
62+
# Test case that calls <tt>@to.accept_verbatim</tt>
63+
2864
def test_accept_verbatim_indent
2965
@to.start_accepting
3066
@to.indent = 2
@@ -33,6 +69,9 @@ def test_accept_verbatim_indent
3369
accept_verbatim_indent
3470
end
3571

72+
##
73+
# Test case that calls <tt>@to.accept_verbatim</tt> with a big indent
74+
3675
def test_accept_verbatim_big_indent
3776
@to.start_accepting
3877
@to.indent = 2
@@ -41,6 +80,9 @@ def test_accept_verbatim_big_indent
4180
accept_verbatim_big_indent
4281
end
4382

83+
##
84+
# Test case that calls <tt>@to.accept_paragraph</tt> with an indent
85+
4486
def test_accept_paragraph_indent
4587
@to.start_accepting
4688
@to.indent = 3
@@ -49,13 +91,21 @@ def test_accept_paragraph_indent
4991
accept_paragraph_indent
5092
end
5193

94+
##
95+
# Test case that calls <tt>@to.accept_paragraph</tt> with a long line
96+
5297
def test_accept_paragraph_wrap
5398
@to.start_accepting
5499
@to.accept_paragraph @RM::Paragraph.new(('words ' * 30).strip)
55100

56101
accept_paragraph_wrap
57102
end
58103

104+
##
105+
# Test case that calls <tt>@to.attributes</tt> with an escaped
106+
# cross-reference. If this test doesn't pass something may be very
107+
# wrong.
108+
59109
def test_attributes
60110
assert_equal 'Dog', @to.attributes("\\Dog")
61111
end

0 commit comments

Comments
 (0)