rdoc 4.3.0 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/.travis.yml +23 -0
- data/CONTRIBUTING.rdoc +4 -3
- data/Gemfile +3 -0
- data/History.rdoc +15 -4
- data/LEGAL.rdoc +2 -2
- data/README.rdoc +1 -0
- data/Rakefile +41 -79
- data/bin/console +7 -0
- data/bin/setup +6 -0
- data/{bin → exe}/rdoc +0 -0
- data/{bin → exe}/ri +0 -0
- data/lib/rdoc.rb +2 -1
- data/lib/rdoc/alias.rb +1 -0
- data/lib/rdoc/anon_class.rb +1 -0
- data/lib/rdoc/any_method.rb +1 -0
- data/lib/rdoc/attr.rb +1 -0
- data/lib/rdoc/class_module.rb +1 -0
- data/lib/rdoc/code_object.rb +1 -0
- data/lib/rdoc/code_objects.rb +1 -0
- data/lib/rdoc/comment.rb +1 -0
- data/lib/rdoc/constant.rb +1 -0
- data/lib/rdoc/context.rb +4 -1
- data/lib/rdoc/context/section.rb +7 -0
- data/lib/rdoc/cross_reference.rb +1 -0
- data/lib/rdoc/encoding.rb +14 -0
- data/lib/rdoc/erb_partial.rb +1 -0
- data/lib/rdoc/erbio.rb +1 -0
- data/lib/rdoc/extend.rb +1 -0
- data/lib/rdoc/generator.rb +1 -0
- data/lib/rdoc/generator/darkfish.rb +1 -0
- data/lib/rdoc/generator/json_index.rb +1 -0
- data/lib/rdoc/generator/markup.rb +1 -0
- data/lib/rdoc/generator/pot.rb +1 -0
- data/lib/rdoc/generator/pot/message_extractor.rb +1 -0
- data/lib/rdoc/generator/pot/po.rb +1 -0
- data/lib/rdoc/generator/pot/po_entry.rb +1 -0
- data/lib/rdoc/generator/ri.rb +1 -0
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +2 -1
- data/lib/rdoc/generator/template/darkfish/css/fonts.css +6 -6
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -7
- data/lib/rdoc/generator/template/json_index/js/searcher.js +1 -0
- data/lib/rdoc/ghost_method.rb +1 -0
- data/lib/rdoc/i18n.rb +1 -0
- data/lib/rdoc/i18n/locale.rb +1 -0
- data/lib/rdoc/i18n/text.rb +1 -0
- data/lib/rdoc/include.rb +1 -0
- data/lib/rdoc/known_classes.rb +1 -0
- data/lib/rdoc/markdown.kpeg +2 -6
- data/lib/rdoc/markdown.rb +2 -6
- data/lib/rdoc/markdown/entities.rb +1 -0
- data/lib/rdoc/markdown/{literals_1_9.kpeg → literals.kpeg} +0 -0
- data/lib/rdoc/markdown/{literals_1_9.rb → literals.rb} +1 -4
- data/lib/rdoc/markup.rb +1 -0
- data/lib/rdoc/markup/attr_changer.rb +1 -0
- data/lib/rdoc/markup/attr_span.rb +1 -0
- data/lib/rdoc/markup/attribute_manager.rb +1 -0
- data/lib/rdoc/markup/attributes.rb +1 -0
- data/lib/rdoc/markup/blank_line.rb +1 -0
- data/lib/rdoc/markup/block_quote.rb +1 -0
- data/lib/rdoc/markup/document.rb +1 -0
- data/lib/rdoc/markup/formatter.rb +1 -0
- data/lib/rdoc/markup/formatter_test_case.rb +1 -4
- data/lib/rdoc/markup/hard_break.rb +1 -0
- data/lib/rdoc/markup/heading.rb +1 -0
- data/lib/rdoc/markup/include.rb +1 -0
- data/lib/rdoc/markup/indented_paragraph.rb +1 -0
- data/lib/rdoc/markup/inline.rb +1 -0
- data/lib/rdoc/markup/list.rb +1 -0
- data/lib/rdoc/markup/list_item.rb +1 -0
- data/lib/rdoc/markup/paragraph.rb +1 -0
- data/lib/rdoc/markup/parser.rb +1 -0
- data/lib/rdoc/markup/pre_process.rb +1 -0
- data/lib/rdoc/markup/raw.rb +1 -0
- data/lib/rdoc/markup/rule.rb +1 -0
- data/lib/rdoc/markup/special.rb +1 -0
- data/lib/rdoc/markup/text_formatter_test_case.rb +1 -0
- data/lib/rdoc/markup/to_ansi.rb +1 -0
- data/lib/rdoc/markup/to_bs.rb +1 -0
- data/lib/rdoc/markup/to_html.rb +1 -0
- data/lib/rdoc/markup/to_html_crossref.rb +1 -0
- data/lib/rdoc/markup/to_html_snippet.rb +1 -0
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -0
- data/lib/rdoc/markup/to_label.rb +1 -0
- data/lib/rdoc/markup/to_markdown.rb +1 -0
- data/lib/rdoc/markup/to_rdoc.rb +1 -0
- data/lib/rdoc/markup/to_table_of_contents.rb +1 -0
- data/lib/rdoc/markup/to_test.rb +1 -0
- data/lib/rdoc/markup/to_tt_only.rb +1 -0
- data/lib/rdoc/markup/verbatim.rb +1 -0
- data/lib/rdoc/meta_method.rb +1 -0
- data/lib/rdoc/method_attr.rb +1 -0
- data/lib/rdoc/mixin.rb +1 -0
- data/lib/rdoc/normal_class.rb +1 -0
- data/lib/rdoc/normal_module.rb +1 -0
- data/lib/rdoc/options.rb +1 -0
- data/lib/rdoc/parser.rb +1 -0
- data/lib/rdoc/parser/c.rb +76 -33
- data/lib/rdoc/parser/changelog.rb +7 -1
- data/lib/rdoc/parser/markdown.rb +1 -0
- data/lib/rdoc/parser/rd.rb +1 -0
- data/lib/rdoc/parser/ruby.rb +1 -0
- data/lib/rdoc/parser/ruby_tools.rb +1 -0
- data/lib/rdoc/parser/simple.rb +1 -0
- data/lib/rdoc/parser/text.rb +1 -0
- data/lib/rdoc/rd.rb +1 -0
- data/lib/rdoc/rd/inline.rb +1 -0
- data/lib/rdoc/rdoc.rb +2 -1
- data/lib/rdoc/require.rb +1 -0
- data/lib/rdoc/ri.rb +1 -0
- data/lib/rdoc/ri/driver.rb +5 -19
- data/lib/rdoc/ri/formatter.rb +1 -0
- data/lib/rdoc/ri/paths.rb +1 -0
- data/lib/rdoc/ri/store.rb +1 -0
- data/lib/rdoc/ri/task.rb +72 -0
- data/lib/rdoc/ruby_lex.rb +11 -17
- data/lib/rdoc/ruby_token.rb +1 -0
- data/lib/rdoc/rubygems_hook.rb +1 -0
- data/lib/rdoc/servlet.rb +4 -3
- data/lib/rdoc/single_class.rb +1 -0
- data/lib/rdoc/stats.rb +1 -0
- data/lib/rdoc/stats/normal.rb +1 -0
- data/lib/rdoc/stats/quiet.rb +1 -0
- data/lib/rdoc/stats/verbose.rb +1 -0
- data/lib/rdoc/store.rb +3 -9
- data/lib/rdoc/task.rb +1 -0
- data/lib/rdoc/test_case.rb +1 -10
- data/lib/rdoc/text.rb +1 -0
- data/lib/rdoc/token_stream.rb +1 -0
- data/lib/rdoc/tom_doc.rb +1 -0
- data/lib/rdoc/top_level.rb +1 -0
- data/rdoc.gemspec +60 -0
- metadata +32 -155
- data/Manifest.txt +0 -309
- data/lib/rdoc/markdown/literals_1_8.kpeg +0 -18
- data/lib/rdoc/markdown/literals_1_8.rb +0 -416
- data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +0 -21
- data/test/MarkdownTest_1.0.3/Auto links.text +0 -13
- data/test/MarkdownTest_1.0.3/Backslash escapes.text +0 -120
- data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +0 -11
- data/test/MarkdownTest_1.0.3/Code Blocks.text +0 -14
- data/test/MarkdownTest_1.0.3/Code Spans.text +0 -6
- data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +0 -8
- data/test/MarkdownTest_1.0.3/Horizontal rules.text +0 -67
- data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +0 -15
- data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +0 -69
- data/test/MarkdownTest_1.0.3/Inline HTML comments.text +0 -13
- data/test/MarkdownTest_1.0.3/Links, inline style.text +0 -12
- data/test/MarkdownTest_1.0.3/Links, reference style.text +0 -71
- data/test/MarkdownTest_1.0.3/Links, shortcut references.text +0 -20
- data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +0 -7
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +0 -306
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +0 -888
- data/test/MarkdownTest_1.0.3/Nested blockquotes.text +0 -5
- data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +0 -131
- data/test/MarkdownTest_1.0.3/Strong and em together.text +0 -7
- data/test/MarkdownTest_1.0.3/Tabs.text +0 -21
- data/test/MarkdownTest_1.0.3/Tidyness.text +0 -5
- data/test/README +0 -1
- data/test/binary.dat +0 -0
- data/test/hidden.zip.txt +0 -1
- data/test/test.ja.largedoc +0 -3
- data/test/test.ja.rdoc +0 -10
- data/test/test.ja.txt +0 -8
- data/test/test.txt +0 -1
- data/test/test_rdoc_alias.rb +0 -13
- data/test/test_rdoc_any_method.rb +0 -460
- data/test/test_rdoc_attr.rb +0 -190
- data/test/test_rdoc_class_module.rb +0 -1492
- data/test/test_rdoc_code_object.rb +0 -450
- data/test/test_rdoc_comment.rb +0 -504
- data/test/test_rdoc_constant.rb +0 -181
- data/test/test_rdoc_context.rb +0 -901
- data/test/test_rdoc_context_section.rb +0 -130
- data/test/test_rdoc_cross_reference.rb +0 -192
- data/test/test_rdoc_encoding.rb +0 -227
- data/test/test_rdoc_extend.rb +0 -94
- data/test/test_rdoc_generator_darkfish.rb +0 -229
- data/test/test_rdoc_generator_json_index.rb +0 -324
- data/test/test_rdoc_generator_markup.rb +0 -59
- data/test/test_rdoc_generator_pot.rb +0 -91
- data/test/test_rdoc_generator_pot_po.rb +0 -51
- data/test/test_rdoc_generator_pot_po_entry.rb +0 -139
- data/test/test_rdoc_generator_ri.rb +0 -78
- data/test/test_rdoc_i18n_locale.rb +0 -73
- data/test/test_rdoc_i18n_text.rb +0 -123
- data/test/test_rdoc_include.rb +0 -108
- data/test/test_rdoc_markdown.rb +0 -980
- data/test/test_rdoc_markdown_test.rb +0 -1884
- data/test/test_rdoc_markup.rb +0 -95
- data/test/test_rdoc_markup_attribute_manager.rb +0 -364
- data/test/test_rdoc_markup_attributes.rb +0 -39
- data/test/test_rdoc_markup_document.rb +0 -207
- data/test/test_rdoc_markup_formatter.rb +0 -175
- data/test/test_rdoc_markup_hard_break.rb +0 -31
- data/test/test_rdoc_markup_heading.rb +0 -29
- data/test/test_rdoc_markup_include.rb +0 -19
- data/test/test_rdoc_markup_indented_paragraph.rb +0 -53
- data/test/test_rdoc_markup_paragraph.rb +0 -32
- data/test/test_rdoc_markup_parser.rb +0 -1680
- data/test/test_rdoc_markup_pre_process.rb +0 -473
- data/test/test_rdoc_markup_raw.rb +0 -22
- data/test/test_rdoc_markup_to_ansi.rb +0 -369
- data/test/test_rdoc_markup_to_bs.rb +0 -366
- data/test/test_rdoc_markup_to_html.rb +0 -662
- data/test/test_rdoc_markup_to_html_crossref.rb +0 -225
- data/test/test_rdoc_markup_to_html_snippet.rb +0 -711
- data/test/test_rdoc_markup_to_joined_paragraph.rb +0 -32
- data/test/test_rdoc_markup_to_label.rb +0 -112
- data/test/test_rdoc_markup_to_markdown.rb +0 -389
- data/test/test_rdoc_markup_to_rdoc.rb +0 -377
- data/test/test_rdoc_markup_to_table_of_contents.rb +0 -126
- data/test/test_rdoc_markup_to_tt_only.rb +0 -246
- data/test/test_rdoc_markup_verbatim.rb +0 -29
- data/test/test_rdoc_method_attr.rb +0 -193
- data/test/test_rdoc_normal_class.rb +0 -47
- data/test/test_rdoc_normal_module.rb +0 -42
- data/test/test_rdoc_options.rb +0 -766
- data/test/test_rdoc_parser.rb +0 -327
- data/test/test_rdoc_parser_c.rb +0 -1896
- data/test/test_rdoc_parser_changelog.rb +0 -315
- data/test/test_rdoc_parser_markdown.rb +0 -61
- data/test/test_rdoc_parser_rd.rb +0 -55
- data/test/test_rdoc_parser_ruby.rb +0 -3322
- data/test/test_rdoc_parser_simple.rb +0 -115
- data/test/test_rdoc_rd.rb +0 -30
- data/test/test_rdoc_rd_block_parser.rb +0 -535
- data/test/test_rdoc_rd_inline.rb +0 -63
- data/test/test_rdoc_rd_inline_parser.rb +0 -177
- data/test/test_rdoc_rdoc.rb +0 -455
- data/test/test_rdoc_require.rb +0 -25
- data/test/test_rdoc_ri_driver.rb +0 -1436
- data/test/test_rdoc_ri_paths.rb +0 -155
- data/test/test_rdoc_ruby_lex.rb +0 -421
- data/test/test_rdoc_ruby_token.rb +0 -19
- data/test/test_rdoc_rubygems_hook.rb +0 -251
- data/test/test_rdoc_servlet.rb +0 -534
- data/test/test_rdoc_single_class.rb +0 -20
- data/test/test_rdoc_stats.rb +0 -722
- data/test/test_rdoc_store.rb +0 -993
- data/test/test_rdoc_task.rb +0 -173
- data/test/test_rdoc_text.rb +0 -557
- data/test/test_rdoc_token_stream.rb +0 -42
- data/test/test_rdoc_tom_doc.rb +0 -520
- data/test/test_rdoc_top_level.rb +0 -287
- data/test/xref_data.rb +0 -76
- data/test/xref_test_case.rb +0 -67
@@ -1,473 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'rdoc/test_case'
|
4
|
-
|
5
|
-
class TestRDocMarkupPreProcess < RDoc::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
|
10
|
-
@tempfile = Tempfile.new 'test_rdoc_markup_pre_process'
|
11
|
-
@file_name = File.basename @tempfile.path
|
12
|
-
@dir = File.dirname @tempfile.path
|
13
|
-
|
14
|
-
@pp = RDoc::Markup::PreProcess.new @tempfile.path, [@dir, File.dirname(__FILE__)]
|
15
|
-
end
|
16
|
-
|
17
|
-
def teardown
|
18
|
-
super
|
19
|
-
|
20
|
-
@tempfile.close!
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_class_register
|
24
|
-
RDoc::Markup::PreProcess.register 'for_test' do raise 'fail' end
|
25
|
-
|
26
|
-
assert_equal %w[for_test], RDoc::Markup::PreProcess.registered.keys
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_class_post_process
|
30
|
-
RDoc::Markup::PreProcess.post_process do end
|
31
|
-
|
32
|
-
assert_equal 1, RDoc::Markup::PreProcess.post_processors.length
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_include_file
|
36
|
-
@tempfile.write <<-INCLUDE
|
37
|
-
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
|
38
|
-
|
39
|
-
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
40
|
-
contents of a string.
|
41
|
-
INCLUDE
|
42
|
-
|
43
|
-
@tempfile.flush
|
44
|
-
@tempfile.rewind
|
45
|
-
|
46
|
-
content = @pp.include_file @file_name, '', nil
|
47
|
-
|
48
|
-
expected = <<-EXPECTED
|
49
|
-
Regular expressions (<i>regexp</i>s) are patterns which describe the
|
50
|
-
contents of a string.
|
51
|
-
EXPECTED
|
52
|
-
|
53
|
-
assert_equal expected, content
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_include_file_encoding_incompatible
|
57
|
-
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
58
|
-
|
59
|
-
@tempfile.write <<-INCLUDE
|
60
|
-
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
|
61
|
-
|
62
|
-
π
|
63
|
-
INCLUDE
|
64
|
-
|
65
|
-
@tempfile.flush
|
66
|
-
@tempfile.rewind
|
67
|
-
|
68
|
-
content = @pp.include_file @file_name, '', Encoding::US_ASCII
|
69
|
-
|
70
|
-
expected = "?\n"
|
71
|
-
|
72
|
-
assert_equal expected, content
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_include_file_in_other_directory
|
76
|
-
content = nil
|
77
|
-
out, err = capture_io do
|
78
|
-
content = @pp.include_file "test.txt", '', nil
|
79
|
-
end
|
80
|
-
|
81
|
-
assert_empty out
|
82
|
-
assert_empty err
|
83
|
-
|
84
|
-
assert_equal "test file\n", content
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_handle
|
88
|
-
text = "# :main: M\n"
|
89
|
-
out = @pp.handle text
|
90
|
-
|
91
|
-
assert_same out, text
|
92
|
-
assert_equal "#\n", text
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_handle_comment
|
96
|
-
text = "# :main: M\n"
|
97
|
-
c = comment text
|
98
|
-
|
99
|
-
out = @pp.handle c
|
100
|
-
|
101
|
-
assert_same out, text
|
102
|
-
assert_equal "#\n", text
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_handle_markup
|
106
|
-
c = comment ':markup: rd'
|
107
|
-
|
108
|
-
@pp.handle c
|
109
|
-
|
110
|
-
assert_equal 'rd', c.format
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_handle_markup_empty
|
114
|
-
c = comment ':markup:'
|
115
|
-
|
116
|
-
@pp.handle c
|
117
|
-
|
118
|
-
assert_equal 'rdoc', c.format
|
119
|
-
end
|
120
|
-
|
121
|
-
def test_handle_post_process
|
122
|
-
cd = RDoc::CodeObject.new
|
123
|
-
|
124
|
-
RDoc::Markup::PreProcess.post_process do |text, code_object|
|
125
|
-
code_object.metadata[:stuff] = text
|
126
|
-
|
127
|
-
:junk
|
128
|
-
end
|
129
|
-
|
130
|
-
text = "# a b c\n"
|
131
|
-
|
132
|
-
out = @pp.handle text, cd
|
133
|
-
|
134
|
-
assert_same out, text
|
135
|
-
assert_equal "# a b c\n", text
|
136
|
-
assert_equal "# a b c\n", cd.metadata[:stuff]
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_handle_unregistered
|
140
|
-
text = "# :x: y\n"
|
141
|
-
out = @pp.handle text
|
142
|
-
|
143
|
-
assert_same out, text
|
144
|
-
assert_equal "# :x: y\n", text
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_handle_directive_blankline
|
148
|
-
result = @pp.handle_directive '#', 'arg', 'a, b'
|
149
|
-
|
150
|
-
assert_equal "#:arg: a, b\n", result
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_handle_directive_downcase
|
154
|
-
method = RDoc::AnyMethod.new nil, 'm'
|
155
|
-
|
156
|
-
@pp.handle_directive '', 'ARG', 'a, b', method
|
157
|
-
|
158
|
-
assert_equal 'a, b', method.params
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_handle_directive_arg
|
162
|
-
method = RDoc::AnyMethod.new nil, 'm'
|
163
|
-
|
164
|
-
@pp.handle_directive '', 'arg', 'a, b', method
|
165
|
-
|
166
|
-
assert_equal 'a, b', method.params
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_handle_directive_arg_no_context
|
170
|
-
result = @pp.handle_directive '', 'arg', 'a, b', nil
|
171
|
-
|
172
|
-
assert_equal ":arg: a, b\n", result
|
173
|
-
end
|
174
|
-
|
175
|
-
def test_handle_directive_args
|
176
|
-
method = RDoc::AnyMethod.new nil, 'm'
|
177
|
-
|
178
|
-
@pp.handle_directive '', 'args', 'a, b', method
|
179
|
-
|
180
|
-
assert_equal 'a, b', method.params
|
181
|
-
end
|
182
|
-
|
183
|
-
def test_handle_directive_block
|
184
|
-
result = @pp.handle_directive '', 'x', 'y' do |directive, param|
|
185
|
-
''
|
186
|
-
end
|
187
|
-
|
188
|
-
assert_empty result
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_handle_directive_block_false
|
192
|
-
result = @pp.handle_directive '', 'x', 'y' do |directive, param|
|
193
|
-
false
|
194
|
-
end
|
195
|
-
|
196
|
-
assert_equal ":x: y\n", result
|
197
|
-
end
|
198
|
-
|
199
|
-
def test_handle_directive_block_nil
|
200
|
-
result = @pp.handle_directive '', 'x', 'y' do |directive, param|
|
201
|
-
nil
|
202
|
-
end
|
203
|
-
|
204
|
-
assert_equal ":x: y\n", result
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_handle_directive_category
|
208
|
-
context = RDoc::Context.new
|
209
|
-
original_section = context.current_section
|
210
|
-
|
211
|
-
@pp.handle_directive '', 'category', 'other', context
|
212
|
-
|
213
|
-
refute_equal original_section, context.current_section
|
214
|
-
end
|
215
|
-
|
216
|
-
def test_handle_directive_doc
|
217
|
-
code_object = RDoc::CodeObject.new
|
218
|
-
code_object.document_self = false
|
219
|
-
code_object.force_documentation = false
|
220
|
-
|
221
|
-
@pp.handle_directive '', 'doc', nil, code_object
|
222
|
-
|
223
|
-
assert code_object.document_self
|
224
|
-
assert code_object.force_documentation
|
225
|
-
end
|
226
|
-
|
227
|
-
def test_handle_directive_doc_no_context
|
228
|
-
result = @pp.handle_directive '', 'doc', nil
|
229
|
-
|
230
|
-
assert_equal "\n", result
|
231
|
-
end
|
232
|
-
|
233
|
-
def test_handle_directive_enddoc
|
234
|
-
code_object = RDoc::CodeObject.new
|
235
|
-
|
236
|
-
@pp.handle_directive '', 'enddoc', nil, code_object
|
237
|
-
|
238
|
-
assert code_object.done_documenting
|
239
|
-
end
|
240
|
-
|
241
|
-
def test_handle_directive_include
|
242
|
-
@tempfile.write 'included'
|
243
|
-
@tempfile.flush
|
244
|
-
|
245
|
-
result = @pp.handle_directive '', 'include', @file_name
|
246
|
-
|
247
|
-
assert_equal 'included', result
|
248
|
-
end
|
249
|
-
|
250
|
-
def test_handle_directive_main
|
251
|
-
@pp.options = RDoc::Options.new
|
252
|
-
|
253
|
-
@pp.handle_directive '', 'main', 'M'
|
254
|
-
|
255
|
-
assert_equal 'M', @pp.options.main_page
|
256
|
-
end
|
257
|
-
|
258
|
-
def test_handle_directive_notnew
|
259
|
-
m = RDoc::AnyMethod.new nil, 'm'
|
260
|
-
|
261
|
-
@pp.handle_directive '', 'notnew', nil, m
|
262
|
-
|
263
|
-
assert m.dont_rename_initialize
|
264
|
-
end
|
265
|
-
|
266
|
-
def test_handle_directive_not_new
|
267
|
-
m = RDoc::AnyMethod.new nil, 'm'
|
268
|
-
|
269
|
-
@pp.handle_directive '', 'not_new', nil, m
|
270
|
-
|
271
|
-
assert m.dont_rename_initialize
|
272
|
-
end
|
273
|
-
|
274
|
-
def test_handle_directive_not_dash_new
|
275
|
-
m = RDoc::AnyMethod.new nil, 'm'
|
276
|
-
|
277
|
-
@pp.handle_directive '', 'not-new', nil, m
|
278
|
-
|
279
|
-
assert m.dont_rename_initialize
|
280
|
-
end
|
281
|
-
|
282
|
-
def test_handle_directive_nodoc
|
283
|
-
code_object = RDoc::CodeObject.new
|
284
|
-
code_object.document_self = true
|
285
|
-
code_object.document_children = true
|
286
|
-
|
287
|
-
@pp.handle_directive '', 'nodoc', nil, code_object
|
288
|
-
|
289
|
-
refute code_object.document_self
|
290
|
-
assert code_object.document_children
|
291
|
-
end
|
292
|
-
|
293
|
-
def test_handle_directive_nodoc_all
|
294
|
-
code_object = RDoc::CodeObject.new
|
295
|
-
code_object.document_self = true
|
296
|
-
code_object.document_children = true
|
297
|
-
|
298
|
-
@pp.handle_directive '', 'nodoc', 'all', code_object
|
299
|
-
|
300
|
-
refute code_object.document_self
|
301
|
-
refute code_object.document_children
|
302
|
-
end
|
303
|
-
|
304
|
-
def test_handle_directive_nodoc_no_context
|
305
|
-
result = @pp.handle_directive '', 'nodoc', nil
|
306
|
-
|
307
|
-
assert_equal "\n", result
|
308
|
-
end
|
309
|
-
|
310
|
-
def test_handle_directive_registered
|
311
|
-
RDoc::Markup::PreProcess.register 'x'
|
312
|
-
|
313
|
-
result = @pp.handle_directive '', 'x', 'y'
|
314
|
-
|
315
|
-
assert_nil result
|
316
|
-
|
317
|
-
result = @pp.handle_directive '', 'x', 'y' do |directive, param|
|
318
|
-
false
|
319
|
-
end
|
320
|
-
|
321
|
-
assert_equal ":x: y\n", result
|
322
|
-
|
323
|
-
result = @pp.handle_directive '', 'x', 'y' do |directive, param|
|
324
|
-
''
|
325
|
-
end
|
326
|
-
|
327
|
-
assert_equal '', result
|
328
|
-
end
|
329
|
-
|
330
|
-
def test_handle_directive_registered_block
|
331
|
-
called = nil
|
332
|
-
|
333
|
-
RDoc::Markup::PreProcess.register 'x' do |directive, param|
|
334
|
-
called = [directive, param]
|
335
|
-
'blah'
|
336
|
-
end
|
337
|
-
|
338
|
-
result = @pp.handle_directive '', 'x', 'y'
|
339
|
-
|
340
|
-
assert_equal 'blah', result
|
341
|
-
assert_equal %w[x y], called
|
342
|
-
end
|
343
|
-
|
344
|
-
def test_handle_directive_registered_code_object
|
345
|
-
RDoc::Markup::PreProcess.register 'x'
|
346
|
-
code_object = RDoc::CodeObject.new
|
347
|
-
|
348
|
-
@pp.handle_directive '', 'x', 'y', code_object
|
349
|
-
|
350
|
-
assert_equal 'y', code_object.metadata['x']
|
351
|
-
|
352
|
-
code_object.metadata.clear
|
353
|
-
|
354
|
-
result = @pp.handle_directive '', 'x', 'y' do |directive, param|
|
355
|
-
false
|
356
|
-
end
|
357
|
-
|
358
|
-
assert_equal ":x: y\n", result
|
359
|
-
assert_empty code_object.metadata
|
360
|
-
|
361
|
-
result = @pp.handle_directive '', 'x', 'y' do |directive, param|
|
362
|
-
''
|
363
|
-
end
|
364
|
-
|
365
|
-
assert_equal '', result
|
366
|
-
assert_empty code_object.metadata
|
367
|
-
end
|
368
|
-
|
369
|
-
def test_handle_directive_startdoc
|
370
|
-
code_object = RDoc::CodeObject.new
|
371
|
-
code_object.stop_doc
|
372
|
-
code_object.force_documentation = false
|
373
|
-
|
374
|
-
@pp.handle_directive '', 'startdoc', nil, code_object
|
375
|
-
|
376
|
-
assert code_object.document_self
|
377
|
-
assert code_object.document_children
|
378
|
-
assert code_object.force_documentation
|
379
|
-
end
|
380
|
-
|
381
|
-
def test_handle_directive_stopdoc
|
382
|
-
code_object = RDoc::CodeObject.new
|
383
|
-
|
384
|
-
@pp.handle_directive '', 'stopdoc', nil, code_object
|
385
|
-
|
386
|
-
refute code_object.document_self
|
387
|
-
refute code_object.document_children
|
388
|
-
end
|
389
|
-
|
390
|
-
def test_handle_directive_title
|
391
|
-
@pp.options = RDoc::Options.new
|
392
|
-
|
393
|
-
@pp.handle_directive '', 'title', 'T'
|
394
|
-
|
395
|
-
assert_equal 'T', @pp.options.title
|
396
|
-
end
|
397
|
-
|
398
|
-
def test_handle_directive_unhandled
|
399
|
-
code_object = RDoc::CodeObject.new
|
400
|
-
|
401
|
-
@pp.handle_directive '', 'x', 'y', code_object
|
402
|
-
|
403
|
-
assert_equal 'y', code_object.metadata['x']
|
404
|
-
|
405
|
-
code_object.metadata.clear
|
406
|
-
|
407
|
-
@pp.handle_directive '', 'x', '', code_object
|
408
|
-
|
409
|
-
assert_includes code_object.metadata, 'x'
|
410
|
-
end
|
411
|
-
|
412
|
-
def test_handle_directive_unhandled_block
|
413
|
-
code_object = RDoc::CodeObject.new
|
414
|
-
|
415
|
-
@pp.handle_directive '', 'x', 'y', code_object do
|
416
|
-
false
|
417
|
-
end
|
418
|
-
|
419
|
-
assert_empty code_object.metadata
|
420
|
-
|
421
|
-
@pp.handle_directive '', 'x', 'y', code_object do
|
422
|
-
nil
|
423
|
-
end
|
424
|
-
|
425
|
-
assert_equal 'y', code_object.metadata['x']
|
426
|
-
|
427
|
-
code_object.metadata.clear
|
428
|
-
|
429
|
-
@pp.handle_directive '', 'x', 'y', code_object do
|
430
|
-
''
|
431
|
-
end
|
432
|
-
|
433
|
-
assert_empty code_object.metadata
|
434
|
-
end
|
435
|
-
|
436
|
-
def test_handle_directive_yield
|
437
|
-
method = RDoc::AnyMethod.new nil, 'm'
|
438
|
-
method.params = 'index, &block'
|
439
|
-
|
440
|
-
@pp.handle_directive '', 'yield', 'item', method
|
441
|
-
|
442
|
-
assert_equal 'item', method.block_params
|
443
|
-
assert_equal 'index', method.params
|
444
|
-
end
|
445
|
-
|
446
|
-
def test_handle_directive_yield_block_param
|
447
|
-
method = RDoc::AnyMethod.new nil, 'm'
|
448
|
-
method.params = '&block'
|
449
|
-
|
450
|
-
@pp.handle_directive '', 'yield', 'item', method
|
451
|
-
|
452
|
-
assert_equal 'item', method.block_params
|
453
|
-
assert_empty method.params
|
454
|
-
end
|
455
|
-
|
456
|
-
def test_handle_directive_yield_no_context
|
457
|
-
method = RDoc::AnyMethod.new nil, 'm'
|
458
|
-
|
459
|
-
@pp.handle_directive '', 'yield', 'item', method
|
460
|
-
|
461
|
-
assert_equal 'item', method.block_params
|
462
|
-
end
|
463
|
-
|
464
|
-
def test_handle_directive_yields
|
465
|
-
method = RDoc::AnyMethod.new nil, 'm'
|
466
|
-
|
467
|
-
@pp.handle_directive '', 'yields', 'item', method
|
468
|
-
|
469
|
-
assert_equal 'item', method.block_params
|
470
|
-
end
|
471
|
-
|
472
|
-
end
|
473
|
-
|