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.

Files changed (248) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +13 -0
  3. data/.travis.yml +23 -0
  4. data/CONTRIBUTING.rdoc +4 -3
  5. data/Gemfile +3 -0
  6. data/History.rdoc +15 -4
  7. data/LEGAL.rdoc +2 -2
  8. data/README.rdoc +1 -0
  9. data/Rakefile +41 -79
  10. data/bin/console +7 -0
  11. data/bin/setup +6 -0
  12. data/{bin → exe}/rdoc +0 -0
  13. data/{bin → exe}/ri +0 -0
  14. data/lib/rdoc.rb +2 -1
  15. data/lib/rdoc/alias.rb +1 -0
  16. data/lib/rdoc/anon_class.rb +1 -0
  17. data/lib/rdoc/any_method.rb +1 -0
  18. data/lib/rdoc/attr.rb +1 -0
  19. data/lib/rdoc/class_module.rb +1 -0
  20. data/lib/rdoc/code_object.rb +1 -0
  21. data/lib/rdoc/code_objects.rb +1 -0
  22. data/lib/rdoc/comment.rb +1 -0
  23. data/lib/rdoc/constant.rb +1 -0
  24. data/lib/rdoc/context.rb +4 -1
  25. data/lib/rdoc/context/section.rb +7 -0
  26. data/lib/rdoc/cross_reference.rb +1 -0
  27. data/lib/rdoc/encoding.rb +14 -0
  28. data/lib/rdoc/erb_partial.rb +1 -0
  29. data/lib/rdoc/erbio.rb +1 -0
  30. data/lib/rdoc/extend.rb +1 -0
  31. data/lib/rdoc/generator.rb +1 -0
  32. data/lib/rdoc/generator/darkfish.rb +1 -0
  33. data/lib/rdoc/generator/json_index.rb +1 -0
  34. data/lib/rdoc/generator/markup.rb +1 -0
  35. data/lib/rdoc/generator/pot.rb +1 -0
  36. data/lib/rdoc/generator/pot/message_extractor.rb +1 -0
  37. data/lib/rdoc/generator/pot/po.rb +1 -0
  38. data/lib/rdoc/generator/pot/po_entry.rb +1 -0
  39. data/lib/rdoc/generator/ri.rb +1 -0
  40. data/lib/rdoc/generator/template/darkfish/_head.rhtml +2 -1
  41. data/lib/rdoc/generator/template/darkfish/css/fonts.css +6 -6
  42. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -7
  43. data/lib/rdoc/generator/template/json_index/js/searcher.js +1 -0
  44. data/lib/rdoc/ghost_method.rb +1 -0
  45. data/lib/rdoc/i18n.rb +1 -0
  46. data/lib/rdoc/i18n/locale.rb +1 -0
  47. data/lib/rdoc/i18n/text.rb +1 -0
  48. data/lib/rdoc/include.rb +1 -0
  49. data/lib/rdoc/known_classes.rb +1 -0
  50. data/lib/rdoc/markdown.kpeg +2 -6
  51. data/lib/rdoc/markdown.rb +2 -6
  52. data/lib/rdoc/markdown/entities.rb +1 -0
  53. data/lib/rdoc/markdown/{literals_1_9.kpeg → literals.kpeg} +0 -0
  54. data/lib/rdoc/markdown/{literals_1_9.rb → literals.rb} +1 -4
  55. data/lib/rdoc/markup.rb +1 -0
  56. data/lib/rdoc/markup/attr_changer.rb +1 -0
  57. data/lib/rdoc/markup/attr_span.rb +1 -0
  58. data/lib/rdoc/markup/attribute_manager.rb +1 -0
  59. data/lib/rdoc/markup/attributes.rb +1 -0
  60. data/lib/rdoc/markup/blank_line.rb +1 -0
  61. data/lib/rdoc/markup/block_quote.rb +1 -0
  62. data/lib/rdoc/markup/document.rb +1 -0
  63. data/lib/rdoc/markup/formatter.rb +1 -0
  64. data/lib/rdoc/markup/formatter_test_case.rb +1 -4
  65. data/lib/rdoc/markup/hard_break.rb +1 -0
  66. data/lib/rdoc/markup/heading.rb +1 -0
  67. data/lib/rdoc/markup/include.rb +1 -0
  68. data/lib/rdoc/markup/indented_paragraph.rb +1 -0
  69. data/lib/rdoc/markup/inline.rb +1 -0
  70. data/lib/rdoc/markup/list.rb +1 -0
  71. data/lib/rdoc/markup/list_item.rb +1 -0
  72. data/lib/rdoc/markup/paragraph.rb +1 -0
  73. data/lib/rdoc/markup/parser.rb +1 -0
  74. data/lib/rdoc/markup/pre_process.rb +1 -0
  75. data/lib/rdoc/markup/raw.rb +1 -0
  76. data/lib/rdoc/markup/rule.rb +1 -0
  77. data/lib/rdoc/markup/special.rb +1 -0
  78. data/lib/rdoc/markup/text_formatter_test_case.rb +1 -0
  79. data/lib/rdoc/markup/to_ansi.rb +1 -0
  80. data/lib/rdoc/markup/to_bs.rb +1 -0
  81. data/lib/rdoc/markup/to_html.rb +1 -0
  82. data/lib/rdoc/markup/to_html_crossref.rb +1 -0
  83. data/lib/rdoc/markup/to_html_snippet.rb +1 -0
  84. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -0
  85. data/lib/rdoc/markup/to_label.rb +1 -0
  86. data/lib/rdoc/markup/to_markdown.rb +1 -0
  87. data/lib/rdoc/markup/to_rdoc.rb +1 -0
  88. data/lib/rdoc/markup/to_table_of_contents.rb +1 -0
  89. data/lib/rdoc/markup/to_test.rb +1 -0
  90. data/lib/rdoc/markup/to_tt_only.rb +1 -0
  91. data/lib/rdoc/markup/verbatim.rb +1 -0
  92. data/lib/rdoc/meta_method.rb +1 -0
  93. data/lib/rdoc/method_attr.rb +1 -0
  94. data/lib/rdoc/mixin.rb +1 -0
  95. data/lib/rdoc/normal_class.rb +1 -0
  96. data/lib/rdoc/normal_module.rb +1 -0
  97. data/lib/rdoc/options.rb +1 -0
  98. data/lib/rdoc/parser.rb +1 -0
  99. data/lib/rdoc/parser/c.rb +76 -33
  100. data/lib/rdoc/parser/changelog.rb +7 -1
  101. data/lib/rdoc/parser/markdown.rb +1 -0
  102. data/lib/rdoc/parser/rd.rb +1 -0
  103. data/lib/rdoc/parser/ruby.rb +1 -0
  104. data/lib/rdoc/parser/ruby_tools.rb +1 -0
  105. data/lib/rdoc/parser/simple.rb +1 -0
  106. data/lib/rdoc/parser/text.rb +1 -0
  107. data/lib/rdoc/rd.rb +1 -0
  108. data/lib/rdoc/rd/inline.rb +1 -0
  109. data/lib/rdoc/rdoc.rb +2 -1
  110. data/lib/rdoc/require.rb +1 -0
  111. data/lib/rdoc/ri.rb +1 -0
  112. data/lib/rdoc/ri/driver.rb +5 -19
  113. data/lib/rdoc/ri/formatter.rb +1 -0
  114. data/lib/rdoc/ri/paths.rb +1 -0
  115. data/lib/rdoc/ri/store.rb +1 -0
  116. data/lib/rdoc/ri/task.rb +72 -0
  117. data/lib/rdoc/ruby_lex.rb +11 -17
  118. data/lib/rdoc/ruby_token.rb +1 -0
  119. data/lib/rdoc/rubygems_hook.rb +1 -0
  120. data/lib/rdoc/servlet.rb +4 -3
  121. data/lib/rdoc/single_class.rb +1 -0
  122. data/lib/rdoc/stats.rb +1 -0
  123. data/lib/rdoc/stats/normal.rb +1 -0
  124. data/lib/rdoc/stats/quiet.rb +1 -0
  125. data/lib/rdoc/stats/verbose.rb +1 -0
  126. data/lib/rdoc/store.rb +3 -9
  127. data/lib/rdoc/task.rb +1 -0
  128. data/lib/rdoc/test_case.rb +1 -10
  129. data/lib/rdoc/text.rb +1 -0
  130. data/lib/rdoc/token_stream.rb +1 -0
  131. data/lib/rdoc/tom_doc.rb +1 -0
  132. data/lib/rdoc/top_level.rb +1 -0
  133. data/rdoc.gemspec +60 -0
  134. metadata +32 -155
  135. data/Manifest.txt +0 -309
  136. data/lib/rdoc/markdown/literals_1_8.kpeg +0 -18
  137. data/lib/rdoc/markdown/literals_1_8.rb +0 -416
  138. data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +0 -21
  139. data/test/MarkdownTest_1.0.3/Auto links.text +0 -13
  140. data/test/MarkdownTest_1.0.3/Backslash escapes.text +0 -120
  141. data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +0 -11
  142. data/test/MarkdownTest_1.0.3/Code Blocks.text +0 -14
  143. data/test/MarkdownTest_1.0.3/Code Spans.text +0 -6
  144. data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +0 -8
  145. data/test/MarkdownTest_1.0.3/Horizontal rules.text +0 -67
  146. data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +0 -15
  147. data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +0 -69
  148. data/test/MarkdownTest_1.0.3/Inline HTML comments.text +0 -13
  149. data/test/MarkdownTest_1.0.3/Links, inline style.text +0 -12
  150. data/test/MarkdownTest_1.0.3/Links, reference style.text +0 -71
  151. data/test/MarkdownTest_1.0.3/Links, shortcut references.text +0 -20
  152. data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +0 -7
  153. data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +0 -306
  154. data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +0 -888
  155. data/test/MarkdownTest_1.0.3/Nested blockquotes.text +0 -5
  156. data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +0 -131
  157. data/test/MarkdownTest_1.0.3/Strong and em together.text +0 -7
  158. data/test/MarkdownTest_1.0.3/Tabs.text +0 -21
  159. data/test/MarkdownTest_1.0.3/Tidyness.text +0 -5
  160. data/test/README +0 -1
  161. data/test/binary.dat +0 -0
  162. data/test/hidden.zip.txt +0 -1
  163. data/test/test.ja.largedoc +0 -3
  164. data/test/test.ja.rdoc +0 -10
  165. data/test/test.ja.txt +0 -8
  166. data/test/test.txt +0 -1
  167. data/test/test_rdoc_alias.rb +0 -13
  168. data/test/test_rdoc_any_method.rb +0 -460
  169. data/test/test_rdoc_attr.rb +0 -190
  170. data/test/test_rdoc_class_module.rb +0 -1492
  171. data/test/test_rdoc_code_object.rb +0 -450
  172. data/test/test_rdoc_comment.rb +0 -504
  173. data/test/test_rdoc_constant.rb +0 -181
  174. data/test/test_rdoc_context.rb +0 -901
  175. data/test/test_rdoc_context_section.rb +0 -130
  176. data/test/test_rdoc_cross_reference.rb +0 -192
  177. data/test/test_rdoc_encoding.rb +0 -227
  178. data/test/test_rdoc_extend.rb +0 -94
  179. data/test/test_rdoc_generator_darkfish.rb +0 -229
  180. data/test/test_rdoc_generator_json_index.rb +0 -324
  181. data/test/test_rdoc_generator_markup.rb +0 -59
  182. data/test/test_rdoc_generator_pot.rb +0 -91
  183. data/test/test_rdoc_generator_pot_po.rb +0 -51
  184. data/test/test_rdoc_generator_pot_po_entry.rb +0 -139
  185. data/test/test_rdoc_generator_ri.rb +0 -78
  186. data/test/test_rdoc_i18n_locale.rb +0 -73
  187. data/test/test_rdoc_i18n_text.rb +0 -123
  188. data/test/test_rdoc_include.rb +0 -108
  189. data/test/test_rdoc_markdown.rb +0 -980
  190. data/test/test_rdoc_markdown_test.rb +0 -1884
  191. data/test/test_rdoc_markup.rb +0 -95
  192. data/test/test_rdoc_markup_attribute_manager.rb +0 -364
  193. data/test/test_rdoc_markup_attributes.rb +0 -39
  194. data/test/test_rdoc_markup_document.rb +0 -207
  195. data/test/test_rdoc_markup_formatter.rb +0 -175
  196. data/test/test_rdoc_markup_hard_break.rb +0 -31
  197. data/test/test_rdoc_markup_heading.rb +0 -29
  198. data/test/test_rdoc_markup_include.rb +0 -19
  199. data/test/test_rdoc_markup_indented_paragraph.rb +0 -53
  200. data/test/test_rdoc_markup_paragraph.rb +0 -32
  201. data/test/test_rdoc_markup_parser.rb +0 -1680
  202. data/test/test_rdoc_markup_pre_process.rb +0 -473
  203. data/test/test_rdoc_markup_raw.rb +0 -22
  204. data/test/test_rdoc_markup_to_ansi.rb +0 -369
  205. data/test/test_rdoc_markup_to_bs.rb +0 -366
  206. data/test/test_rdoc_markup_to_html.rb +0 -662
  207. data/test/test_rdoc_markup_to_html_crossref.rb +0 -225
  208. data/test/test_rdoc_markup_to_html_snippet.rb +0 -711
  209. data/test/test_rdoc_markup_to_joined_paragraph.rb +0 -32
  210. data/test/test_rdoc_markup_to_label.rb +0 -112
  211. data/test/test_rdoc_markup_to_markdown.rb +0 -389
  212. data/test/test_rdoc_markup_to_rdoc.rb +0 -377
  213. data/test/test_rdoc_markup_to_table_of_contents.rb +0 -126
  214. data/test/test_rdoc_markup_to_tt_only.rb +0 -246
  215. data/test/test_rdoc_markup_verbatim.rb +0 -29
  216. data/test/test_rdoc_method_attr.rb +0 -193
  217. data/test/test_rdoc_normal_class.rb +0 -47
  218. data/test/test_rdoc_normal_module.rb +0 -42
  219. data/test/test_rdoc_options.rb +0 -766
  220. data/test/test_rdoc_parser.rb +0 -327
  221. data/test/test_rdoc_parser_c.rb +0 -1896
  222. data/test/test_rdoc_parser_changelog.rb +0 -315
  223. data/test/test_rdoc_parser_markdown.rb +0 -61
  224. data/test/test_rdoc_parser_rd.rb +0 -55
  225. data/test/test_rdoc_parser_ruby.rb +0 -3322
  226. data/test/test_rdoc_parser_simple.rb +0 -115
  227. data/test/test_rdoc_rd.rb +0 -30
  228. data/test/test_rdoc_rd_block_parser.rb +0 -535
  229. data/test/test_rdoc_rd_inline.rb +0 -63
  230. data/test/test_rdoc_rd_inline_parser.rb +0 -177
  231. data/test/test_rdoc_rdoc.rb +0 -455
  232. data/test/test_rdoc_require.rb +0 -25
  233. data/test/test_rdoc_ri_driver.rb +0 -1436
  234. data/test/test_rdoc_ri_paths.rb +0 -155
  235. data/test/test_rdoc_ruby_lex.rb +0 -421
  236. data/test/test_rdoc_ruby_token.rb +0 -19
  237. data/test/test_rdoc_rubygems_hook.rb +0 -251
  238. data/test/test_rdoc_servlet.rb +0 -534
  239. data/test/test_rdoc_single_class.rb +0 -20
  240. data/test/test_rdoc_stats.rb +0 -722
  241. data/test/test_rdoc_store.rb +0 -993
  242. data/test/test_rdoc_task.rb +0 -173
  243. data/test/test_rdoc_text.rb +0 -557
  244. data/test/test_rdoc_token_stream.rb +0 -42
  245. data/test/test_rdoc_tom_doc.rb +0 -520
  246. data/test/test_rdoc_top_level.rb +0 -287
  247. data/test/xref_data.rb +0 -76
  248. 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
-