rdoc 3.9.5 → 3.10.pre.1

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 (183) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +6 -3
  3. data/History.txt +63 -13
  4. data/LICENSE.rdoc +57 -0
  5. data/Manifest.txt +60 -6
  6. data/Rakefile +24 -12
  7. data/TODO.rdoc +30 -0
  8. data/bin/rdoc +0 -2
  9. data/lib/rdoc.rb +55 -2
  10. data/lib/rdoc/alias.rb +0 -2
  11. data/lib/rdoc/anon_class.rb +0 -2
  12. data/lib/rdoc/any_method.rb +0 -3
  13. data/lib/rdoc/attr.rb +0 -2
  14. data/lib/rdoc/class_module.rb +40 -7
  15. data/lib/rdoc/code_object.rb +1 -3
  16. data/lib/rdoc/code_objects.rb +3 -21
  17. data/lib/rdoc/comment.rb +225 -0
  18. data/lib/rdoc/constant.rb +0 -2
  19. data/lib/rdoc/context.rb +37 -120
  20. data/lib/rdoc/context/section.rb +114 -0
  21. data/lib/rdoc/cross_reference.rb +16 -7
  22. data/lib/rdoc/encoding.rb +0 -2
  23. data/lib/rdoc/gauntlet.rb +1 -1
  24. data/lib/rdoc/generator.rb +7 -2
  25. data/lib/rdoc/generator/darkfish.rb +126 -20
  26. data/lib/rdoc/generator/json_index.rb +240 -0
  27. data/lib/rdoc/generator/markup.rb +17 -54
  28. data/lib/rdoc/generator/ri.rb +0 -3
  29. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  30. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -0
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +18 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +9 -0
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +8 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +16 -0
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +12 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +7 -0
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +12 -0
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +10 -0
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +10 -0
  40. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +10 -0
  41. data/lib/rdoc/generator/template/darkfish/class.rhtml +161 -0
  42. data/lib/rdoc/generator/template/darkfish/fileinfo.rhtml +32 -0
  43. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  44. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/index.rhtml +16 -61
  48. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +99 -64
  49. data/lib/rdoc/generator/template/darkfish/js/jquery.js +15 -29
  50. data/lib/rdoc/generator/template/darkfish/js/search.js +94 -0
  51. data/lib/rdoc/generator/template/darkfish/page.rhtml +16 -0
  52. data/lib/rdoc/generator/template/darkfish/rdoc.css +126 -286
  53. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +50 -0
  54. data/lib/rdoc/generator/template/json_index/js/navigation.js +142 -0
  55. data/lib/rdoc/generator/template/json_index/js/searcher.js +228 -0
  56. data/lib/rdoc/ghost_method.rb +0 -2
  57. data/lib/rdoc/include.rb +0 -2
  58. data/lib/rdoc/markup.rb +204 -43
  59. data/lib/rdoc/markup/attr_changer.rb +25 -0
  60. data/lib/rdoc/markup/attr_span.rb +29 -0
  61. data/lib/rdoc/markup/attribute.rb +51 -0
  62. data/lib/rdoc/markup/document.rb +22 -1
  63. data/lib/rdoc/markup/formatter.rb +4 -11
  64. data/lib/rdoc/markup/formatter_test_case.rb +1 -2
  65. data/lib/rdoc/markup/heading.rb +44 -0
  66. data/lib/rdoc/markup/include.rb +42 -0
  67. data/lib/rdoc/markup/inline.rb +1 -144
  68. data/lib/rdoc/markup/list.rb +2 -1
  69. data/lib/rdoc/markup/parser.rb +6 -16
  70. data/lib/rdoc/markup/pre_process.rb +64 -10
  71. data/lib/rdoc/markup/raw.rb +1 -1
  72. data/lib/rdoc/markup/special.rb +40 -0
  73. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -2
  74. data/lib/rdoc/markup/to_ansi.rb +0 -2
  75. data/lib/rdoc/markup/to_bs.rb +0 -2
  76. data/lib/rdoc/markup/to_html.rb +102 -34
  77. data/lib/rdoc/markup/to_html_crossref.rb +36 -5
  78. data/lib/rdoc/markup/to_html_snippet.rb +270 -0
  79. data/lib/rdoc/markup/to_label.rb +55 -0
  80. data/lib/rdoc/markup/to_rdoc.rb +0 -3
  81. data/lib/rdoc/markup/to_table_of_contents.rb +62 -0
  82. data/lib/rdoc/markup/to_test.rb +0 -3
  83. data/lib/rdoc/markup/to_tt_only.rb +0 -3
  84. data/lib/rdoc/markup/verbatim.rb +18 -0
  85. data/lib/rdoc/meta_method.rb +0 -2
  86. data/lib/rdoc/method_attr.rb +17 -1
  87. data/lib/rdoc/normal_class.rb +0 -2
  88. data/lib/rdoc/normal_module.rb +0 -2
  89. data/lib/rdoc/options.rb +18 -3
  90. data/lib/rdoc/parser.rb +74 -42
  91. data/lib/rdoc/parser/c.rb +79 -118
  92. data/lib/rdoc/parser/rd.rb +22 -0
  93. data/lib/rdoc/parser/ruby.rb +86 -54
  94. data/lib/rdoc/parser/simple.rb +21 -9
  95. data/lib/rdoc/parser/text.rb +11 -0
  96. data/lib/rdoc/rd.rb +95 -0
  97. data/lib/rdoc/rd/block_parser.ry +638 -0
  98. data/lib/rdoc/rd/inline.rb +71 -0
  99. data/lib/rdoc/rd/inline_parser.ry +575 -0
  100. data/lib/rdoc/rdoc.rb +8 -23
  101. data/lib/rdoc/require.rb +0 -2
  102. data/lib/rdoc/ri.rb +4 -2
  103. data/lib/rdoc/ri/driver.rb +2 -6
  104. data/lib/rdoc/ri/store.rb +0 -1
  105. data/lib/rdoc/ruby_lex.rb +43 -20
  106. data/lib/rdoc/ruby_token.rb +44 -2
  107. data/lib/rdoc/single_class.rb +0 -2
  108. data/lib/rdoc/stats.rb +0 -5
  109. data/lib/rdoc/task.rb +2 -6
  110. data/lib/rdoc/test_case.rb +59 -0
  111. data/lib/rdoc/text.rb +42 -30
  112. data/lib/rdoc/token_stream.rb +45 -0
  113. data/lib/rdoc/tom_doc.rb +232 -0
  114. data/lib/rdoc/top_level.rb +36 -4
  115. data/test/test_attribute_manager.rb +26 -29
  116. data/test/test_rdoc_any_method.rb +2 -26
  117. data/test/test_rdoc_attr.rb +4 -4
  118. data/test/test_rdoc_class_module.rb +95 -12
  119. data/test/test_rdoc_code_object.rb +10 -3
  120. data/test/test_rdoc_comment.rb +504 -0
  121. data/test/test_rdoc_context.rb +60 -11
  122. data/test/test_rdoc_context_section.rb +16 -17
  123. data/test/test_rdoc_cross_reference.rb +17 -2
  124. data/test/test_rdoc_encoding.rb +4 -7
  125. data/test/test_rdoc_generator_darkfish.rb +12 -11
  126. data/test/test_rdoc_generator_json_index.rb +255 -0
  127. data/test/test_rdoc_generator_markup.rb +56 -0
  128. data/test/test_rdoc_generator_ri.rb +8 -11
  129. data/test/test_rdoc_markup.rb +9 -5
  130. data/test/test_rdoc_markup_attribute_manager.rb +5 -8
  131. data/test/test_rdoc_markup_document.rb +34 -6
  132. data/test/test_rdoc_markup_formatter.rb +11 -13
  133. data/test/test_rdoc_markup_heading.rb +20 -0
  134. data/test/test_rdoc_markup_include.rb +19 -0
  135. data/test/test_rdoc_markup_indented_paragraph.rb +4 -5
  136. data/test/test_rdoc_markup_paragraph.rb +2 -5
  137. data/test/test_rdoc_markup_parser.rb +87 -7
  138. data/test/test_rdoc_markup_pre_process.rb +60 -9
  139. data/test/test_rdoc_markup_raw.rb +4 -6
  140. data/test/test_rdoc_markup_to_ansi.rb +1 -4
  141. data/test/test_rdoc_markup_to_bs.rb +1 -4
  142. data/test/test_rdoc_markup_to_html.rb +170 -31
  143. data/test/test_rdoc_markup_to_html_crossref.rb +89 -11
  144. data/test/test_rdoc_markup_to_html_snippet.rb +668 -0
  145. data/test/test_rdoc_markup_to_label.rb +50 -0
  146. data/test/test_rdoc_markup_to_rdoc.rb +1 -4
  147. data/test/test_rdoc_markup_to_table_of_contents.rb +90 -0
  148. data/test/test_rdoc_markup_to_tt_only.rb +1 -4
  149. data/test/test_rdoc_markup_verbatim.rb +16 -0
  150. data/test/test_rdoc_method_attr.rb +16 -1
  151. data/test/test_rdoc_options.rb +17 -7
  152. data/test/test_rdoc_parser.rb +75 -6
  153. data/test/test_rdoc_parser_c.rb +56 -104
  154. data/test/test_rdoc_parser_rd.rb +52 -0
  155. data/test/test_rdoc_parser_ruby.rb +264 -323
  156. data/test/test_rdoc_parser_simple.rb +33 -17
  157. data/test/test_rdoc_rd.rb +30 -0
  158. data/test/test_rdoc_rd_block_parser.rb +527 -0
  159. data/test/test_rdoc_rd_inline.rb +63 -0
  160. data/test/test_rdoc_rd_inline_parser.rb +173 -0
  161. data/test/test_rdoc_rdoc.rb +7 -9
  162. data/test/test_rdoc_ri_driver.rb +10 -15
  163. data/test/test_rdoc_ri_paths.rb +6 -6
  164. data/test/test_rdoc_ri_store.rb +6 -13
  165. data/test/test_rdoc_ruby_lex.rb +53 -5
  166. data/test/test_rdoc_rubygems_hook.rb +2 -1
  167. data/test/test_rdoc_stats.rb +83 -103
  168. data/test/test_rdoc_task.rb +5 -4
  169. data/test/test_rdoc_text.rb +156 -11
  170. data/test/test_rdoc_token_stream.rb +42 -0
  171. data/test/test_rdoc_tom_doc.rb +458 -0
  172. data/test/test_rdoc_top_level.rb +49 -2
  173. data/test/xref_test_case.rb +4 -8
  174. metadata +217 -111
  175. metadata.gz.sig +0 -0
  176. checksums.yaml +0 -7
  177. checksums.yaml.gz.sig +0 -0
  178. data/CVE-2013-0256.rdoc +0 -49
  179. data/LICENSE.txt +0 -57
  180. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -321
  181. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -124
  182. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
  183. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
@@ -1,11 +1,12 @@
1
- require 'rubygems/test_case'
2
1
  require 'rubygems'
2
+ require 'rubygems/test_case'
3
3
  require 'rdoc/rubygems_hook'
4
4
 
5
5
  class TestRDocRubygemsHook < Gem::TestCase
6
6
 
7
7
  def setup
8
8
  super
9
+
9
10
  skip 'requires RubyGems 1.9+' unless
10
11
  Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.9')
11
12
 
@@ -1,26 +1,23 @@
1
- require 'rubygems'
2
- require 'minitest/autorun'
3
- require 'rdoc/stats'
4
- require 'rdoc/code_objects'
5
- require 'rdoc/markup'
6
- require 'rdoc/parser'
1
+ require 'rdoc/test_case'
7
2
 
8
- class TestRDocStats < MiniTest::Unit::TestCase
3
+ class TestRDocStats < RDoc::TestCase
9
4
 
10
5
  def setup
11
- RDoc::TopLevel.reset
6
+ super
12
7
 
13
8
  @s = RDoc::Stats.new 0
9
+
10
+ @tl = RDoc::TopLevel.new 'file.rb'
11
+ @tl.parser = RDoc::Parser::Ruby
14
12
  end
15
13
 
16
14
  def test_report_attr
17
- tl = RDoc::TopLevel.new 'file.rb'
18
- c = tl.add_class RDoc::NormalClass, 'C'
19
- c.record_location tl
20
- c.add_comment 'C', tl
15
+ c = @tl.add_class RDoc::NormalClass, 'C'
16
+ c.record_location @tl
17
+ c.add_comment 'C', @tl
21
18
 
22
19
  a = RDoc::Attr.new nil, 'a', 'RW', nil
23
- a.record_location tl
20
+ a.record_location @tl
24
21
  c.add_attribute a
25
22
 
26
23
  RDoc::TopLevel.complete :public
@@ -40,13 +37,12 @@ end
40
37
  end
41
38
 
42
39
  def test_report_attr_documented
43
- tl = RDoc::TopLevel.new 'file.rb'
44
- c = tl.add_class RDoc::NormalClass, 'C'
45
- c.record_location tl
46
- c.add_comment 'C', tl
40
+ c = @tl.add_class RDoc::NormalClass, 'C'
41
+ c.record_location @tl
42
+ c.add_comment 'C', @tl
47
43
 
48
44
  a = RDoc::Attr.new nil, 'a', 'RW', 'a'
49
- a.record_location tl
45
+ a.record_location @tl
50
46
  c.add_attribute a
51
47
 
52
48
  RDoc::TopLevel.complete :public
@@ -57,13 +53,12 @@ end
57
53
  end
58
54
 
59
55
  def test_report_constant
60
- tl = RDoc::TopLevel.new 'file.rb'
61
- m = tl.add_module RDoc::NormalModule, 'M'
62
- m.record_location tl
63
- m.add_comment 'M', tl
56
+ m = @tl.add_module RDoc::NormalModule, 'M'
57
+ m.record_location @tl
58
+ m.add_comment 'M', @tl
64
59
 
65
60
  c = RDoc::Constant.new 'C', nil, nil
66
- c.record_location tl
61
+ c.record_location @tl
67
62
  m.add_constant c
68
63
 
69
64
  RDoc::TopLevel.complete :public
@@ -84,16 +79,15 @@ end
84
79
  end
85
80
 
86
81
  def test_report_constant_alias
87
- tl = RDoc::TopLevel.new 'file.rb'
88
- mod = tl.add_module RDoc::NormalModule, 'M'
82
+ mod = @tl.add_module RDoc::NormalModule, 'M'
89
83
 
90
- c = tl.add_class RDoc::NormalClass, 'C'
84
+ c = @tl.add_class RDoc::NormalClass, 'C'
91
85
  mod.add_constant c
92
86
 
93
87
  ca = RDoc::Constant.new 'CA', nil, nil
94
88
  ca.is_alias_for = c
95
89
 
96
- tl.add_constant ca
90
+ @tl.add_constant ca
97
91
 
98
92
  RDoc::TopLevel.complete :public
99
93
 
@@ -105,13 +99,12 @@ end
105
99
  end
106
100
 
107
101
  def test_report_constant_documented
108
- tl = RDoc::TopLevel.new 'file.rb'
109
- m = tl.add_module RDoc::NormalModule, 'M'
110
- m.record_location tl
102
+ m = @tl.add_module RDoc::NormalModule, 'M'
103
+ m.record_location @tl
111
104
  m.comment = 'M'
112
105
 
113
106
  c = RDoc::Constant.new 'C', nil, 'C'
114
- c.record_location tl
107
+ c.record_location @tl
115
108
  m.add_constant c
116
109
 
117
110
  RDoc::TopLevel.complete :public
@@ -122,12 +115,11 @@ end
122
115
  end
123
116
 
124
117
  def test_report_class
125
- tl = RDoc::TopLevel.new 'file.rb'
126
- c = tl.add_class RDoc::NormalClass, 'C'
127
- c.record_location tl
118
+ c = @tl.add_class RDoc::NormalClass, 'C'
119
+ c.record_location @tl
128
120
 
129
121
  m = RDoc::AnyMethod.new nil, 'm'
130
- m.record_location tl
122
+ m.record_location @tl
131
123
  c.add_method m
132
124
  m.comment = 'm'
133
125
 
@@ -149,13 +141,12 @@ end
149
141
  end
150
142
 
151
143
  def test_report_class_documented
152
- tl = RDoc::TopLevel.new 'file.rb'
153
- c = tl.add_class RDoc::NormalClass, 'C'
154
- c.record_location tl
155
- c.add_comment 'C', tl
144
+ c = @tl.add_class RDoc::NormalClass, 'C'
145
+ c.record_location @tl
146
+ c.add_comment 'C', @tl
156
147
 
157
148
  m = RDoc::AnyMethod.new nil, 'm'
158
- m.record_location tl
149
+ m.record_location @tl
159
150
  c.add_method m
160
151
  m.comment = 'm'
161
152
 
@@ -167,21 +158,20 @@ end
167
158
  end
168
159
 
169
160
  def test_report_class_documented_level_1
170
- tl = RDoc::TopLevel.new 'file.rb'
171
- c1 = tl.add_class RDoc::NormalClass, 'C1'
172
- c1.record_location tl
173
- c1.add_comment 'C1', tl
161
+ c1 = @tl.add_class RDoc::NormalClass, 'C1'
162
+ c1.record_location @tl
163
+ c1.add_comment 'C1', @tl
174
164
 
175
165
  m1 = RDoc::AnyMethod.new nil, 'm1'
176
- m1.record_location tl
166
+ m1.record_location @tl
177
167
  c1.add_method m1
178
168
  m1.comment = 'm1'
179
169
 
180
- c2 = tl.add_class RDoc::NormalClass, 'C2'
181
- c2.record_location tl
170
+ c2 = @tl.add_class RDoc::NormalClass, 'C2'
171
+ c2.record_location @tl
182
172
 
183
173
  m2 = RDoc::AnyMethod.new nil, 'm2'
184
- m2.record_location tl
174
+ m2.record_location @tl
185
175
  c2.add_method m2
186
176
  m2.comment = 'm2'
187
177
 
@@ -206,8 +196,7 @@ end
206
196
  end
207
197
 
208
198
  def test_report_class_empty
209
- tl = RDoc::TopLevel.new 'file.rb'
210
- tl.add_class RDoc::NormalClass, 'C'
199
+ @tl.add_class RDoc::NormalClass, 'C'
211
200
 
212
201
  RDoc::TopLevel.complete :public
213
202
 
@@ -225,13 +214,12 @@ The following items are not documented:
225
214
  end
226
215
 
227
216
  def test_report_class_empty_2
228
- tl = RDoc::TopLevel.new 'file.rb'
229
- c1 = tl.add_class RDoc::NormalClass, 'C1'
230
- c1.record_location tl
217
+ c1 = @tl.add_class RDoc::NormalClass, 'C1'
218
+ c1.record_location @tl
231
219
 
232
- c2 = tl.add_class RDoc::NormalClass, 'C2'
233
- c2.record_location tl
234
- c2.add_comment 'C2', tl
220
+ c2 = @tl.add_class RDoc::NormalClass, 'C2'
221
+ c2.record_location @tl
222
+ c2.add_comment 'C2', @tl
235
223
 
236
224
  RDoc::TopLevel.complete :public
237
225
 
@@ -253,12 +241,11 @@ end
253
241
  end
254
242
 
255
243
  def test_report_class_method_documented
256
- tl = RDoc::TopLevel.new 'file.rb'
257
- c = tl.add_class RDoc::NormalClass, 'C'
258
- c.record_location tl
244
+ c = @tl.add_class RDoc::NormalClass, 'C'
245
+ c.record_location @tl
259
246
 
260
247
  m = RDoc::AnyMethod.new nil, 'm'
261
- m.record_location tl
248
+ m.record_location @tl
262
249
  c.add_method m
263
250
  m.comment = 'm'
264
251
 
@@ -288,17 +275,16 @@ end
288
275
  end
289
276
 
290
277
  def test_report_method
291
- tl = RDoc::TopLevel.new 'file.rb'
292
- c = tl.add_class RDoc::NormalClass, 'C'
293
- c.record_location tl
294
- c.add_comment 'C', tl
278
+ c = @tl.add_class RDoc::NormalClass, 'C'
279
+ c.record_location @tl
280
+ c.add_comment 'C', @tl
295
281
 
296
282
  m1 = RDoc::AnyMethod.new nil, 'm1'
297
- m1.record_location tl
283
+ m1.record_location @tl
298
284
  c.add_method m1
299
285
 
300
286
  m2 = RDoc::AnyMethod.new nil, 'm2'
301
- m2.record_location tl
287
+ m2.record_location @tl
302
288
  c.add_method m2
303
289
  m2.comment = 'm2'
304
290
 
@@ -321,13 +307,12 @@ end
321
307
  end
322
308
 
323
309
  def test_report_method_documented
324
- tl = RDoc::TopLevel.new 'file.rb'
325
- c = tl.add_class RDoc::NormalClass, 'C'
326
- c.record_location tl
327
- c.add_comment 'C', tl
310
+ c = @tl.add_class RDoc::NormalClass, 'C'
311
+ c.record_location @tl
312
+ c.add_comment 'C', @tl
328
313
 
329
314
  m = RDoc::AnyMethod.new nil, 'm'
330
- m.record_location tl
315
+ m.record_location @tl
331
316
  c.add_method m
332
317
  m.comment = 'm'
333
318
 
@@ -339,19 +324,18 @@ end
339
324
  end
340
325
 
341
326
  def test_report_method_parameters
342
- tl = RDoc::TopLevel.new 'file.rb'
343
- c = tl.add_class RDoc::NormalClass, 'C'
344
- c.record_location tl
345
- c.add_comment 'C', tl
327
+ c = @tl.add_class RDoc::NormalClass, 'C'
328
+ c.record_location @tl
329
+ c.add_comment 'C', @tl
346
330
 
347
331
  m1 = RDoc::AnyMethod.new nil, 'm1'
348
- m1.record_location tl
332
+ m1.record_location @tl
349
333
  m1.params = '(p1, p2)'
350
334
  m1.comment = 'Stuff with +p1+'
351
335
  c.add_method m1
352
336
 
353
337
  m2 = RDoc::AnyMethod.new nil, 'm2'
354
- m2.record_location tl
338
+ m2.record_location @tl
355
339
  c.add_method m2
356
340
  m2.comment = 'm2'
357
341
 
@@ -376,13 +360,13 @@ end
376
360
  end
377
361
 
378
362
  def test_report_method_parameters_documented
379
- tl = RDoc::TopLevel.new 'file.rb'
380
- c = tl.add_class RDoc::NormalClass, 'C'
381
- c.record_location tl
382
- c.add_comment 'C', tl
363
+ @tl.parser = RDoc::Parser::Ruby
364
+ c = @tl.add_class RDoc::NormalClass, 'C'
365
+ c.record_location @tl
366
+ c.add_comment 'C', @tl
383
367
 
384
368
  m = RDoc::AnyMethod.new nil, 'm'
385
- m.record_location tl
369
+ m.record_location @tl
386
370
  m.params = '(p1)'
387
371
  m.comment = 'Stuff with +p1+'
388
372
  c.add_method m
@@ -396,13 +380,12 @@ end
396
380
  end
397
381
 
398
382
  def test_report_method_parameters_yield
399
- tl = RDoc::TopLevel.new 'file.rb'
400
- c = tl.add_class RDoc::NormalClass, 'C'
401
- c.record_location tl
402
- c.add_comment 'C', tl
383
+ c = @tl.add_class RDoc::NormalClass, 'C'
384
+ c.record_location @tl
385
+ c.add_comment 'C', @tl
403
386
 
404
387
  m = RDoc::AnyMethod.new nil, 'm'
405
- m.record_location tl
388
+ m.record_location @tl
406
389
  m.call_seq = <<-SEQ
407
390
  m(a) { |c| ... }
408
391
  m(a, b) { |c, d| ... }
@@ -431,23 +414,22 @@ end
431
414
  end
432
415
 
433
416
  def test_summary
434
- tl = RDoc::TopLevel.new 'file.rb'
435
- c = tl.add_class RDoc::NormalClass, 'C'
436
- c.record_location tl
417
+ c = @tl.add_class RDoc::NormalClass, 'C'
418
+ c.record_location @tl
437
419
 
438
- m = tl.add_module RDoc::NormalModule, 'M'
439
- m.record_location tl
420
+ m = @tl.add_module RDoc::NormalModule, 'M'
421
+ m.record_location @tl
440
422
 
441
423
  a = RDoc::Attr.new nil, 'a', 'RW', nil
442
- a.record_location tl
424
+ a.record_location @tl
443
425
  c.add_attribute a
444
426
 
445
427
  c_c = RDoc::Constant.new 'C', nil, nil
446
- c_c.record_location tl
428
+ c_c.record_location @tl
447
429
  c.add_constant c_c
448
430
 
449
431
  m = RDoc::AnyMethod.new nil, 'm'
450
- m.record_location tl
432
+ m.record_location @tl
451
433
  c.add_method m
452
434
 
453
435
  RDoc::TopLevel.complete :public
@@ -473,9 +455,8 @@ Total: 5 (5 undocumented)
473
455
  end
474
456
 
475
457
  def test_summary_level_false
476
- tl = RDoc::TopLevel.new 'file.rb'
477
- c = tl.add_class RDoc::NormalClass, 'C'
478
- c.record_location tl
458
+ c = @tl.add_class RDoc::NormalClass, 'C'
459
+ c.record_location @tl
479
460
 
480
461
  RDoc::TopLevel.complete :public
481
462
 
@@ -502,13 +483,12 @@ Total: 1 (1 undocumented)
502
483
  end
503
484
 
504
485
  def test_summary_level_1
505
- tl = RDoc::TopLevel.new 'file.rb'
506
- c = tl.add_class RDoc::NormalClass, 'C'
507
- c.record_location tl
508
- c.add_comment 'C', tl
486
+ c = @tl.add_class RDoc::NormalClass, 'C'
487
+ c.record_location @tl
488
+ c.add_comment 'C', @tl
509
489
 
510
490
  m = RDoc::AnyMethod.new nil, 'm'
511
- m.record_location tl
491
+ m.record_location @tl
512
492
  m.params = '(p1, p2)'
513
493
  m.comment = 'Stuff with +p1+'
514
494
  c.add_method m
@@ -1,10 +1,11 @@
1
- require 'rubygems'
2
- require 'minitest/autorun'
3
- require 'rdoc/task'
1
+ require 'rdoc/test_case'
2
+ require 'rake'
4
3
 
5
- class TestRDocTask < MiniTest::Unit::TestCase
4
+ class TestRDocTask < RDoc::TestCase
6
5
 
7
6
  def setup
7
+ super
8
+
8
9
  Rake::Task.clear
9
10
 
10
11
  @t = RDoc::Task.new
@@ -1,16 +1,17 @@
1
1
  # coding: utf-8
2
2
 
3
- require 'rubygems'
4
- require 'minitest/autorun'
5
- require 'rdoc'
6
- require 'rdoc/text'
7
- require 'rdoc/markup'
8
- require 'rdoc/markup/formatter'
3
+ require 'rdoc/test_case'
9
4
 
10
- class TestRDocText < MiniTest::Unit::TestCase
5
+ class TestRDocText < RDoc::TestCase
11
6
 
12
7
  include RDoc::Text
13
8
 
9
+ def setup
10
+ super
11
+
12
+ @top_level = RDoc::TopLevel.new 'file.rb'
13
+ end
14
+
14
15
  def test_self_encode_fallback
15
16
  skip "Encoding not implemented" unless Object.const_defined? :Encoding
16
17
 
@@ -110,13 +111,19 @@ The comments associated with
110
111
  assert_equal Encoding::US_ASCII, result.encoding
111
112
  end
112
113
 
113
- def test_markup
114
- def formatter() RDoc::Markup::ToHtml.new end
114
+ def test_markup_string
115
+ out = markup('hi').gsub("\n", '')
116
+
117
+ assert_equal '<p>hi</p>', out
118
+ end
119
+
120
+ def test_markup_comment
121
+ out = markup(comment('hi')).gsub("\n", '')
115
122
 
116
- assert_equal "<p>hi</p>", markup('hi').gsub("\n", '')
123
+ assert_equal '<p>hi</p>', out
117
124
  end
118
125
 
119
- def test_normalize_comment
126
+ def test_normalize_comment_hash
120
127
  text = <<-TEXT
121
128
  ##
122
129
  # we don't worry too much.
@@ -127,6 +134,42 @@ The comments associated with
127
134
  expected = <<-EXPECTED.rstrip
128
135
  we don't worry too much.
129
136
 
137
+ The comments associated with
138
+ EXPECTED
139
+
140
+ assert_equal expected, normalize_comment(text)
141
+ end
142
+
143
+ def test_normalize_comment_stars_single_space
144
+ text = <<-TEXT
145
+ /*
146
+ * we don't worry too much.
147
+ *
148
+ * The comments associated with
149
+ */
150
+ TEXT
151
+
152
+ expected = <<-EXPECTED.rstrip
153
+ we don't worry too much.
154
+
155
+ The comments associated with
156
+ EXPECTED
157
+
158
+ assert_equal expected, normalize_comment(text)
159
+ end
160
+
161
+ def test_normalize_comment_stars_single_double_space
162
+ text = <<-TEXT
163
+ /*
164
+ * we don't worry too much.
165
+ *
166
+ * The comments associated with
167
+ */
168
+ TEXT
169
+
170
+ expected = <<-EXPECTED.rstrip
171
+ we don't worry too much.
172
+
130
173
  The comments associated with
131
174
  EXPECTED
132
175
 
@@ -137,6 +180,17 @@ The comments associated with
137
180
  assert_kind_of RDoc::Markup::Document, parse('hi')
138
181
  end
139
182
 
183
+ def test_parse_comment
184
+ expected = RDoc::Markup::Document.new
185
+ expected.file = @top_level
186
+
187
+ c = comment ''
188
+ parsed = parse c
189
+
190
+ assert_equal expected, parsed
191
+ assert_same parsed, parse(c)
192
+ end
193
+
140
194
  def test_parse_document
141
195
  assert_equal RDoc::Markup::Document.new, parse(RDoc::Markup::Document.new)
142
196
  end
@@ -149,10 +203,79 @@ The comments associated with
149
203
  assert_equal RDoc::Markup::Document.new, parse("#\n")
150
204
  end
151
205
 
206
+ def test_parse_format_rd
207
+ expected =
208
+ @RM::Document.new(
209
+ @RM::Paragraph.new('it <em>works</em>'))
210
+
211
+ parsed = parse 'it ((*works*))', 'rd'
212
+
213
+ assert_equal expected, parsed
214
+ end
215
+
216
+ def test_parse_format_tomdoc
217
+ expected =
218
+ @RM::Document.new(
219
+ @RM::Paragraph.new('It does a thing'),
220
+ @RM::BlankLine.new,
221
+ @RM::Heading.new(3, 'Examples'),
222
+ @RM::BlankLine.new,
223
+ @RM::Verbatim.new("1 + 1"))
224
+
225
+ text = <<-TOMDOC
226
+ It does a thing
227
+
228
+ Examples
229
+
230
+ 1 + 1
231
+ TOMDOC
232
+
233
+ parsed = parse text, 'tomdoc'
234
+
235
+ assert_equal expected, parsed
236
+ end
237
+
152
238
  def test_parse_newline
153
239
  assert_equal RDoc::Markup::Document.new, parse("\n")
154
240
  end
155
241
 
242
+ # def test_snippet
243
+ # text = <<-TEXT
244
+ #This is one-hundred characters or more of text in a single paragraph. This
245
+ #paragraph will be cut off some point after the one-hundredth character.
246
+ # TEXT
247
+ #
248
+ # expected = text.gsub(/\r?\n/, ' ').sub(/ some point.*/, '')
249
+ #
250
+ # assert_equal expected, snippet(text)
251
+ # end
252
+ #
253
+ # def test_snippet_comment
254
+ # c = comment 'This is a comment'
255
+ #
256
+ # assert_equal 'This is a comment', snippet(c)
257
+ # end
258
+ #
259
+ # def test_snippet_no_space
260
+ # text = <<-TEXT.strip
261
+ #This is one-hundred characters or more of text in a single paragraph. This
262
+ #paragraph will not be cut
263
+ # TEXT
264
+ #
265
+ # expected = <<-EXPECTED.strip.gsub(/\r?\n/, ' ')
266
+ #This is one-hundred characters or more of text in a single paragraph. This
267
+ #paragraph will not be cut
268
+ # EXPECTED
269
+ #
270
+ # assert_equal expected, snippet(text)
271
+ # end
272
+ #
273
+ # def test_snippet_short
274
+ # text = 'This is a comment'
275
+ #
276
+ # assert_equal text.dup, snippet(text)
277
+ # end
278
+
156
279
  def test_strip_hashes
157
280
  text = <<-TEXT
158
281
  ##
@@ -309,6 +432,24 @@ The comments associated with
309
432
  assert_equal Encoding::BINARY, result.encoding
310
433
  end
311
434
 
435
+ def test_strip_stars_no_stars
436
+ text = <<-TEXT
437
+ * we don't worry too much.
438
+
439
+ The comments associated with
440
+
441
+ TEXT
442
+
443
+ expected = <<-EXPECTED
444
+ * we don't worry too much.
445
+
446
+ The comments associated with
447
+
448
+ EXPECTED
449
+
450
+ assert_equal expected, strip_stars(text)
451
+ end
452
+
312
453
  def test_to_html_apostrophe
313
454
  assert_equal '‘a', to_html("'a")
314
455
  assert_equal 'a’', to_html("a'")
@@ -393,5 +534,9 @@ The comments associated with
393
534
  assert_equal "mismatched <tt> tag\n", err
394
535
  end
395
536
 
537
+ def formatter()
538
+ RDoc::Markup::ToHtml.new
539
+ end
540
+
396
541
  end
397
542