rdoc 4.0.1 → 4.1.0.preview.3
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +1 -3
- data/{DEVELOPERS.rdoc → CONTRIBUTING.rdoc} +28 -3
- data/ExampleMarkdown.md +37 -0
- data/ExampleRDoc.rdoc +208 -0
- data/History.rdoc +81 -0
- data/Manifest.txt +11 -2
- data/README.rdoc +5 -5
- data/Rakefile +34 -4
- data/lib/rdoc.rb +4 -3
- data/lib/rdoc/any_method.rb +48 -4
- data/lib/rdoc/class_module.rb +16 -2
- data/lib/rdoc/code_object.rb +85 -24
- data/lib/rdoc/comment.rb +0 -3
- data/lib/rdoc/constant.rb +9 -1
- data/lib/rdoc/context.rb +20 -2
- data/lib/rdoc/cross_reference.rb +1 -1
- data/lib/rdoc/extend.rb +4 -112
- data/lib/rdoc/generator/darkfish.rb +46 -7
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +3 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +3 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +9 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +12 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +5 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +6 -7
- data/lib/rdoc/generator/template/darkfish/class.rhtml +36 -41
- data/lib/rdoc/generator/template/darkfish/fonts.css +167 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +11 -7
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -15
- data/lib/rdoc/generator/template/darkfish/js/search.js +12 -4
- data/lib/rdoc/generator/template/darkfish/page.rhtml +9 -9
- data/lib/rdoc/generator/template/darkfish/rdoc.css +226 -241
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +13 -6
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +17 -14
- data/lib/rdoc/include.rb +4 -114
- data/lib/rdoc/known_classes.rb +1 -0
- data/lib/rdoc/markdown.kpeg +126 -117
- data/lib/rdoc/markdown.rb +404 -389
- data/lib/rdoc/markdown/literals_1_8.kpeg +1 -1
- data/lib/rdoc/markdown/literals_1_8.rb +15 -12
- data/lib/rdoc/markdown/literals_1_9.kpeg +1 -1
- data/lib/rdoc/markdown/literals_1_9.rb +15 -12
- data/lib/rdoc/markup.rb +10 -13
- data/lib/rdoc/markup/attribute_manager.rb +3 -2
- data/lib/rdoc/markup/formatter.rb +3 -3
- data/lib/rdoc/markup/heading.rb +13 -0
- data/lib/rdoc/markup/parser.rb +10 -3
- data/lib/rdoc/markup/pre_process.rb +1 -1
- data/lib/rdoc/markup/to_html.rb +46 -31
- data/lib/rdoc/markup/to_html_crossref.rb +3 -0
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_markdown.rb +7 -5
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/method_attr.rb +13 -1
- data/lib/rdoc/mixin.rb +120 -0
- data/lib/rdoc/normal_class.rb +4 -0
- data/lib/rdoc/normal_module.rb +4 -0
- data/lib/rdoc/options.rb +42 -8
- data/lib/rdoc/parser.rb +4 -2
- data/lib/rdoc/parser/c.rb +13 -7
- data/lib/rdoc/parser/ruby.rb +683 -480
- data/lib/rdoc/rdoc.rb +4 -3
- data/lib/rdoc/ri/driver.rb +174 -103
- data/lib/rdoc/ri/paths.rb +6 -6
- data/lib/rdoc/ruby_lex.rb +125 -102
- data/lib/rdoc/ruby_token.rb +41 -40
- data/lib/rdoc/servlet.rb +16 -6
- data/lib/rdoc/stats.rb +61 -48
- data/lib/rdoc/store.rb +5 -3
- data/lib/rdoc/test_case.rb +39 -0
- data/lib/rdoc/tom_doc.rb +28 -4
- data/lib/rdoc/top_level.rb +2 -2
- data/test/test_rdoc_any_method.rb +104 -1
- data/test/test_rdoc_class_module.rb +9 -15
- data/test/test_rdoc_code_object.rb +133 -8
- data/test/test_rdoc_context.rb +17 -0
- data/test/test_rdoc_context_section.rb +0 -7
- data/test/test_rdoc_cross_reference.rb +4 -3
- data/test/test_rdoc_generator_darkfish.rb +61 -19
- data/test/test_rdoc_generator_json_index.rb +0 -11
- data/test/test_rdoc_generator_ri.rb +0 -8
- data/test/test_rdoc_markdown.rb +15 -12
- data/test/test_rdoc_markdown_test.rb +0 -7
- data/test/test_rdoc_markup_attribute_manager.rb +121 -0
- data/test/test_rdoc_markup_document.rb +0 -7
- data/test/test_rdoc_markup_formatter.rb +29 -3
- data/test/test_rdoc_markup_heading.rb +9 -0
- data/test/test_rdoc_markup_parser.rb +0 -7
- data/test/test_rdoc_markup_pre_process.rb +15 -3
- data/test/test_rdoc_markup_raw.rb +0 -7
- data/test/test_rdoc_markup_to_html.rb +50 -8
- data/test/test_rdoc_markup_to_html_crossref.rb +7 -0
- data/test/test_rdoc_markup_to_html_snippet.rb +4 -4
- data/test/test_rdoc_markup_to_markdown.rb +6 -0
- data/test/test_rdoc_method_attr.rb +8 -0
- data/test/test_rdoc_normal_class.rb +5 -0
- data/test/test_rdoc_normal_module.rb +5 -0
- data/test/test_rdoc_options.rb +61 -22
- data/test/test_rdoc_parser.rb +10 -0
- data/test/test_rdoc_parser_c.rb +17 -5
- data/test/test_rdoc_parser_changelog.rb +0 -7
- data/test/test_rdoc_parser_rd.rb +0 -7
- data/test/test_rdoc_parser_ruby.rb +305 -28
- data/test/test_rdoc_rd_block_parser.rb +0 -8
- data/test/test_rdoc_rd_inline_parser.rb +0 -1
- data/test/test_rdoc_rdoc.rb +27 -1
- data/test/test_rdoc_ri_driver.rb +19 -7
- data/test/test_rdoc_ruby_lex.rb +116 -9
- data/test/test_rdoc_rubygems_hook.rb +1 -1
- data/test/test_rdoc_servlet.rb +44 -6
- data/test/test_rdoc_stats.rb +161 -141
- data/test/test_rdoc_store.rb +11 -19
- data/test/test_rdoc_text.rb +0 -7
- data/test/test_rdoc_tom_doc.rb +44 -16
- data/test/xref_test_case.rb +2 -0
- metadata +28 -27
- metadata.gz.sig +0 -0
- data/test/test_attribute_manager.rb +0 -120
@@ -8,13 +8,6 @@ class TestRDocRdBlockParser < RDoc::TestCase
|
|
8
8
|
@block_parser = RDoc::RD::BlockParser.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def mu_pp(obj)
|
12
|
-
s = ""
|
13
|
-
s = PP.pp obj, s
|
14
|
-
s = s.force_encoding(Encoding.default_external) if defined? Encoding
|
15
|
-
s.chomp
|
16
|
-
end
|
17
|
-
|
18
11
|
def test_add_footnote
|
19
12
|
index = @block_parser.add_footnote 'context'
|
20
13
|
|
@@ -538,4 +531,3 @@ two
|
|
538
531
|
end
|
539
532
|
|
540
533
|
end
|
541
|
-
|
data/test/test_rdoc_rdoc.rb
CHANGED
@@ -108,7 +108,13 @@ class TestRDocRDoc < RDoc::TestCase
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def test_normalized_file_list
|
111
|
-
files =
|
111
|
+
files = temp_dir do |dir|
|
112
|
+
flag_file = @rdoc.output_flag_file dir
|
113
|
+
|
114
|
+
FileUtils.touch flag_file
|
115
|
+
|
116
|
+
@rdoc.normalized_file_list [__FILE__, flag_file]
|
117
|
+
end
|
112
118
|
|
113
119
|
files = files.map { |file| File.expand_path file }
|
114
120
|
|
@@ -179,6 +185,26 @@ class TestRDocRDoc < RDoc::TestCase
|
|
179
185
|
assert_empty err
|
180
186
|
end
|
181
187
|
|
188
|
+
def test_parse_file_include_root
|
189
|
+
@rdoc.store = RDoc::Store.new
|
190
|
+
|
191
|
+
top_level = nil
|
192
|
+
temp_dir do |dir|
|
193
|
+
@rdoc.options.parse %W[--root #{File.dirname(__FILE__)}]
|
194
|
+
|
195
|
+
open 'include.txt', 'w' do |io|
|
196
|
+
io.puts ':include: test.txt'
|
197
|
+
end
|
198
|
+
|
199
|
+
out, err = capture_io do
|
200
|
+
top_level = @rdoc.parse_file 'include.txt'
|
201
|
+
end
|
202
|
+
assert_empty out
|
203
|
+
assert_empty err
|
204
|
+
end
|
205
|
+
assert_equal "test file", top_level.comment.text
|
206
|
+
end
|
207
|
+
|
182
208
|
def test_parse_file_page_dir
|
183
209
|
@rdoc.store = RDoc::Store.new
|
184
210
|
|
data/test/test_rdoc_ri_driver.rb
CHANGED
@@ -46,13 +46,6 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
46
46
|
ENV['RI_PAGER'] = pager_env
|
47
47
|
end
|
48
48
|
|
49
|
-
def mu_pp(obj)
|
50
|
-
s = ''
|
51
|
-
s = PP.pp obj, s
|
52
|
-
s = s.force_encoding(Encoding.default_external) if defined? Encoding
|
53
|
-
s.chomp
|
54
|
-
end
|
55
|
-
|
56
49
|
def test_self_dump
|
57
50
|
util_store
|
58
51
|
|
@@ -696,6 +689,14 @@ Foo::Bar#bother
|
|
696
689
|
assert_equal expected, out
|
697
690
|
end
|
698
691
|
|
692
|
+
def test_display_name_not_found_special
|
693
|
+
util_store
|
694
|
+
|
695
|
+
assert_raises RDoc::RI::Driver::NotFoundError do
|
696
|
+
assert_equal false, @driver.display_name('Set#[]')
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
699
700
|
def test_display_method_params
|
700
701
|
util_store
|
701
702
|
|
@@ -1097,6 +1098,17 @@ Foo::Bar#bother
|
|
1097
1098
|
assert_equal expected, @driver.load_methods_matching('Bar#inherit')
|
1098
1099
|
end
|
1099
1100
|
|
1101
|
+
def test_load_method_missing
|
1102
|
+
util_store
|
1103
|
+
|
1104
|
+
FileUtils.rm @store1.method_file 'Foo', '#inherit'
|
1105
|
+
|
1106
|
+
method = @driver.load_method(@store1, :instance_methods, 'Foo', '#',
|
1107
|
+
'inherit')
|
1108
|
+
|
1109
|
+
assert_equal '(unknown)#inherit', method.full_name
|
1110
|
+
end
|
1111
|
+
|
1100
1112
|
def _test_page # this test doesn't do anything anymore :(
|
1101
1113
|
@driver.use_stdout = false
|
1102
1114
|
|
data/test/test_rdoc_ruby_lex.rb
CHANGED
@@ -8,13 +8,6 @@ class TestRDocRubyLex < RDoc::TestCase
|
|
8
8
|
@TK = RDoc::RubyToken
|
9
9
|
end
|
10
10
|
|
11
|
-
def mu_pp obj
|
12
|
-
s = ''
|
13
|
-
s = PP.pp obj, s
|
14
|
-
s = s.force_encoding(Encoding.default_external) if defined? Encoding
|
15
|
-
s.chomp
|
16
|
-
end
|
17
|
-
|
18
11
|
def test_class_tokenize
|
19
12
|
tokens = RDoc::RubyLex.tokenize "def x() end", nil
|
20
13
|
|
@@ -47,8 +40,8 @@ class TestRDocRubyLex < RDoc::TestCase
|
|
47
40
|
tokens = RDoc::RubyLex.tokenize "?\\", nil
|
48
41
|
|
49
42
|
expected = [
|
50
|
-
@TK::
|
51
|
-
@TK::TkNL
|
43
|
+
@TK::TkCHAR.new( 0, 1, 0, "?\\"),
|
44
|
+
@TK::TkNL .new( 2, 1, 2, "\n"),
|
52
45
|
]
|
53
46
|
|
54
47
|
assert_equal expected, tokens
|
@@ -249,6 +242,26 @@ U
|
|
249
242
|
assert_equal expected, tokens
|
250
243
|
end
|
251
244
|
|
245
|
+
def test_class_tokenize_regexp_options
|
246
|
+
tokens = RDoc::RubyLex.tokenize "/hAY/i", nil
|
247
|
+
|
248
|
+
expected = [
|
249
|
+
@TK::TkREGEXP.new( 0, 1, 0, "/hAY/i"),
|
250
|
+
@TK::TkNL .new( 6, 1, 6, "\n"),
|
251
|
+
]
|
252
|
+
|
253
|
+
assert_equal expected, tokens
|
254
|
+
|
255
|
+
tokens = RDoc::RubyLex.tokenize "/hAY/ix", nil
|
256
|
+
|
257
|
+
expected = [
|
258
|
+
@TK::TkREGEXP.new( 0, 1, 0, "/hAY/ix"),
|
259
|
+
@TK::TkNL .new( 7, 1, 7, "\n"),
|
260
|
+
]
|
261
|
+
|
262
|
+
assert_equal expected, tokens
|
263
|
+
end
|
264
|
+
|
252
265
|
def test_class_tokenize_regexp_backref
|
253
266
|
tokens = RDoc::RubyLex.tokenize "/[csh](..) [csh]\\1 in/", nil
|
254
267
|
|
@@ -282,6 +295,100 @@ U
|
|
282
295
|
assert_equal expected, tokens
|
283
296
|
end
|
284
297
|
|
298
|
+
def test_class_tokenize_string_escape
|
299
|
+
tokens = RDoc::RubyLex.tokenize '"\\n"', nil
|
300
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\n\""), tokens.first
|
301
|
+
|
302
|
+
tokens = RDoc::RubyLex.tokenize '"\\r"', nil
|
303
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\r\""), tokens.first
|
304
|
+
|
305
|
+
tokens = RDoc::RubyLex.tokenize '"\\f"', nil
|
306
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\f\""), tokens.first
|
307
|
+
|
308
|
+
tokens = RDoc::RubyLex.tokenize '"\\\\"', nil
|
309
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\\\\""), tokens.first
|
310
|
+
|
311
|
+
tokens = RDoc::RubyLex.tokenize '"\\t"', nil
|
312
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\t\""), tokens.first
|
313
|
+
|
314
|
+
tokens = RDoc::RubyLex.tokenize '"\\v"', nil
|
315
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\v\""), tokens.first
|
316
|
+
|
317
|
+
tokens = RDoc::RubyLex.tokenize '"\\a"', nil
|
318
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\a\""), tokens.first
|
319
|
+
|
320
|
+
tokens = RDoc::RubyLex.tokenize '"\\e"', nil
|
321
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\e\""), tokens.first
|
322
|
+
|
323
|
+
tokens = RDoc::RubyLex.tokenize '"\\b"', nil
|
324
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\b\""), tokens.first
|
325
|
+
|
326
|
+
tokens = RDoc::RubyLex.tokenize '"\\s"', nil
|
327
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\s\""), tokens.first
|
328
|
+
|
329
|
+
tokens = RDoc::RubyLex.tokenize '"\\d"', nil
|
330
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\d\""), tokens.first
|
331
|
+
|
332
|
+
end
|
333
|
+
|
334
|
+
def test_class_tokenize_string_escape_control
|
335
|
+
tokens = RDoc::RubyLex.tokenize '"\\C-a"', nil
|
336
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\C-a\""), tokens.first
|
337
|
+
|
338
|
+
tokens = RDoc::RubyLex.tokenize '"\\c\\a"', nil
|
339
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\c\\a\""), tokens.first
|
340
|
+
|
341
|
+
tokens = RDoc::RubyLex.tokenize '"\\C-\\M-a"', nil
|
342
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\C-\\M-a\""), tokens.first
|
343
|
+
end
|
344
|
+
|
345
|
+
def test_class_tokenize_string_escape_meta
|
346
|
+
tokens = RDoc::RubyLex.tokenize '"\\M-a"', nil
|
347
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\M-a\""), tokens.first
|
348
|
+
|
349
|
+
tokens = RDoc::RubyLex.tokenize '"\\M-\\C-a"', nil
|
350
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\M-\\C-a\""), tokens.first
|
351
|
+
end
|
352
|
+
|
353
|
+
def test_class_tokenize_string_escape_hexadecimal
|
354
|
+
tokens = RDoc::RubyLex.tokenize '"\\x0"', nil
|
355
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\x0\""), tokens.first
|
356
|
+
|
357
|
+
tokens = RDoc::RubyLex.tokenize '"\\x00"', nil
|
358
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\x00\""), tokens.first
|
359
|
+
|
360
|
+
tokens = RDoc::RubyLex.tokenize '"\\x000"', nil
|
361
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\x000\""), tokens.first
|
362
|
+
end
|
363
|
+
|
364
|
+
def test_class_tokenize_string_escape_octal
|
365
|
+
tokens = RDoc::RubyLex.tokenize '"\\0"', nil
|
366
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\0\""), tokens.first
|
367
|
+
|
368
|
+
tokens = RDoc::RubyLex.tokenize '"\\00"', nil
|
369
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\00\""), tokens.first
|
370
|
+
|
371
|
+
tokens = RDoc::RubyLex.tokenize '"\\000"', nil
|
372
|
+
assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\000\""), tokens.first
|
373
|
+
end
|
374
|
+
|
375
|
+
def test_class_tokenize_symbol
|
376
|
+
tokens = RDoc::RubyLex.tokenize 'scope module: :v1', nil
|
377
|
+
|
378
|
+
expected = [
|
379
|
+
@TK::TkIDENTIFIER.new( 0, 1, 0, 'scope'),
|
380
|
+
@TK::TkSPACE .new( 5, 1, 5, ' '),
|
381
|
+
@TK::TkIDENTIFIER.new( 6, 1, 6, 'module'),
|
382
|
+
@TK::TkCOLON .new(12, 1, 12, ':'),
|
383
|
+
@TK::TkSPACE .new(13, 1, 13, ' '),
|
384
|
+
@TK::TkSYMBEG .new(14, 1, 14, ':'),
|
385
|
+
@TK::TkIDENTIFIER.new(15, 1, 15, 'v1'),
|
386
|
+
@TK::TkNL .new(17, 1, 17, "\n"),
|
387
|
+
]
|
388
|
+
|
389
|
+
assert_equal expected, tokens
|
390
|
+
end
|
391
|
+
|
285
392
|
def test_unary_minus
|
286
393
|
ruby_lex = RDoc::RubyLex.new("-1", nil)
|
287
394
|
assert_equal("-1", ruby_lex.token.value)
|
@@ -10,7 +10,7 @@ class TestRDocRubygemsHook < Gem::TestCase
|
|
10
10
|
skip 'requires RubyGems 1.9+' unless
|
11
11
|
Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.9')
|
12
12
|
|
13
|
-
@a =
|
13
|
+
@a = util_spec 'a', 2 do |s|
|
14
14
|
s.rdoc_options = %w[--main MyTitle]
|
15
15
|
s.extra_rdoc_files = %w[README]
|
16
16
|
end
|
data/test/test_rdoc_servlet.rb
CHANGED
@@ -147,6 +147,16 @@ class TestRDocServlet < RDoc::TestCase
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
+
def do_GET_not_found
|
151
|
+
touch_system_cache_path
|
152
|
+
|
153
|
+
@req.path = "/#{@spec.full_name}"
|
154
|
+
|
155
|
+
@s.do_GET @req, @res
|
156
|
+
|
157
|
+
assert_equal 404, @res.status
|
158
|
+
end
|
159
|
+
|
150
160
|
def test_do_GET_not_modified
|
151
161
|
touch_system_cache_path
|
152
162
|
@req.header['if-modified-since'] = [(Time.now + 10).httpdate]
|
@@ -189,8 +199,8 @@ class TestRDocServlet < RDoc::TestCase
|
|
189
199
|
|
190
200
|
@s.documentation_page store, generator, 'Klass::Sub.html', @req, @res
|
191
201
|
|
192
|
-
assert_match %r%<title>class Klass::Sub - </title>%,
|
193
|
-
assert_match %r%<body id="top" class="class">%,
|
202
|
+
assert_match %r%<title>class Klass::Sub - </title>%, @res.body
|
203
|
+
assert_match %r%<body id="top" role="document" class="class">%, @res.body
|
194
204
|
end
|
195
205
|
|
196
206
|
def test_documentation_page_not_found
|
@@ -216,7 +226,7 @@ class TestRDocServlet < RDoc::TestCase
|
|
216
226
|
@s.documentation_page store, generator, 'README_rdoc.html', @req, @res
|
217
227
|
|
218
228
|
assert_match %r%<title>README - </title>%, @res.body
|
219
|
-
assert_match %r%<body class="file">%, @res.body
|
229
|
+
assert_match %r%<body [^>]+ class="file">%, @res.body
|
220
230
|
end
|
221
231
|
|
222
232
|
def test_documentation_source
|
@@ -332,6 +342,18 @@ class TestRDocServlet < RDoc::TestCase
|
|
332
342
|
assert_match %r%<kbd>/ruby/Missing\.html</kbd>%, @res.body
|
333
343
|
end
|
334
344
|
|
345
|
+
def test_not_found_message
|
346
|
+
generator = @s.generator_for RDoc::Store.new
|
347
|
+
|
348
|
+
@req.path = '/ruby/Missing.html'
|
349
|
+
|
350
|
+
@s.not_found generator, @req, @res, 'woo, this is a message'
|
351
|
+
|
352
|
+
assert_equal 404, @res.status
|
353
|
+
assert_match %r%<title>Not Found</title>%, @res.body
|
354
|
+
assert_match %r%woo, this is a message%, @res.body
|
355
|
+
end
|
356
|
+
|
335
357
|
def test_ri_paths
|
336
358
|
paths = @s.ri_paths
|
337
359
|
|
@@ -433,6 +455,10 @@ class TestRDocServlet < RDoc::TestCase
|
|
433
455
|
end
|
434
456
|
|
435
457
|
def test_store_for_gem
|
458
|
+
ri_dir = File.join @gem_doc_dir, 'spec-1.0', 'ri'
|
459
|
+
FileUtils.mkdir_p ri_dir
|
460
|
+
FileUtils.touch File.join ri_dir, 'cache.ri'
|
461
|
+
|
436
462
|
store = @s.store_for 'spec-1.0'
|
437
463
|
|
438
464
|
assert_equal File.join(@gem_doc_dir, 'spec-1.0', 'ri'), store.path
|
@@ -446,12 +472,24 @@ class TestRDocServlet < RDoc::TestCase
|
|
446
472
|
assert_equal :home, store.type
|
447
473
|
end
|
448
474
|
|
449
|
-
def
|
450
|
-
|
475
|
+
def test_store_for_missing_documentation
|
476
|
+
FileUtils.mkdir_p(File.join @gem_doc_dir, 'spec-1.0', 'ri')
|
477
|
+
|
478
|
+
e = assert_raises WEBrick::HTTPStatus::NotFound do
|
479
|
+
@s.store_for 'spec-1.0'
|
480
|
+
end
|
481
|
+
|
482
|
+
assert_equal 'Could not find documentation for "spec-1.0". Please run `gem rdoc --ri gem_name`',
|
483
|
+
e.message
|
484
|
+
end
|
485
|
+
|
486
|
+
def test_store_for_missing_gem
|
487
|
+
e = assert_raises WEBrick::HTTPStatus::NotFound do
|
451
488
|
@s.store_for 'missing'
|
452
489
|
end
|
453
490
|
|
454
|
-
assert_equal '
|
491
|
+
assert_equal 'Could not find gem "missing". Are you sure you installed it?',
|
492
|
+
e.message
|
455
493
|
end
|
456
494
|
|
457
495
|
def test_store_for_ruby
|
data/test/test_rdoc_stats.rb
CHANGED
@@ -44,14 +44,17 @@ class TestRDocStats < RDoc::TestCase
|
|
44
44
|
|
45
45
|
report = @s.report
|
46
46
|
|
47
|
-
expected =
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
expected =
|
48
|
+
doc(
|
49
|
+
para('The following items are not documented:'),
|
50
|
+
blank_line,
|
51
|
+
verb(
|
52
|
+
"class C # is documented\n",
|
53
|
+
"\n",
|
54
|
+
" attr_accessor :a # in file file.rb\n",
|
55
|
+
"\n",
|
56
|
+
"end\n"),
|
57
|
+
blank_line)
|
55
58
|
|
56
59
|
assert_equal expected, report
|
57
60
|
end
|
@@ -84,7 +87,7 @@ end
|
|
84
87
|
|
85
88
|
@store.complete :public
|
86
89
|
|
87
|
-
assert_match '# in file file.rb:3', @s.report
|
90
|
+
assert_match '# in file file.rb:3', @s.report.accept(to_rdoc)
|
88
91
|
end
|
89
92
|
|
90
93
|
def test_report_constant
|
@@ -100,15 +103,18 @@ end
|
|
100
103
|
|
101
104
|
report = @s.report
|
102
105
|
|
103
|
-
expected =
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
106
|
+
expected =
|
107
|
+
doc(
|
108
|
+
para('The following items are not documented:'),
|
109
|
+
blank_line,
|
110
|
+
verb(
|
111
|
+
"module M # is documented\n",
|
112
|
+
"\n",
|
113
|
+
" # in file file.rb\n",
|
114
|
+
" C = nil\n",
|
115
|
+
"\n",
|
116
|
+
"end\n"),
|
117
|
+
blank_line)
|
112
118
|
|
113
119
|
assert_equal expected, report
|
114
120
|
end
|
@@ -130,13 +136,13 @@ end
|
|
130
136
|
|
131
137
|
# TODO change this to refute match, aliases should be ignored as they are
|
132
138
|
# programmer convenience constructs
|
133
|
-
assert_match
|
139
|
+
assert_match 'class Object', report.accept(to_rdoc)
|
134
140
|
end
|
135
141
|
|
136
142
|
def test_report_constant_documented
|
137
143
|
m = @tl.add_module RDoc::NormalModule, 'M'
|
138
144
|
m.record_location @tl
|
139
|
-
m.
|
145
|
+
m.add_comment 'M', @tl
|
140
146
|
|
141
147
|
c = RDoc::Constant.new 'C', nil, 'C'
|
142
148
|
c.record_location @tl
|
@@ -161,7 +167,7 @@ end
|
|
161
167
|
|
162
168
|
@store.complete :public
|
163
169
|
|
164
|
-
assert_match '# in file file.rb:5', @s.report
|
170
|
+
assert_match '# in file file.rb:5', @s.report.accept(to_rdoc)
|
165
171
|
end
|
166
172
|
|
167
173
|
def test_report_class
|
@@ -177,15 +183,16 @@ end
|
|
177
183
|
|
178
184
|
report = @s.report
|
179
185
|
|
180
|
-
expected =
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
186
|
+
expected =
|
187
|
+
doc(
|
188
|
+
para('The following items are not documented:'),
|
189
|
+
blank_line,
|
190
|
+
para('In files:'),
|
191
|
+
list(:BULLET, *[
|
192
|
+
item(nil, para('file.rb'))]),
|
193
|
+
blank_line,
|
194
|
+
verb("class C\n", "end\n"),
|
195
|
+
blank_line)
|
189
196
|
|
190
197
|
assert_equal expected, report
|
191
198
|
end
|
@@ -201,7 +208,7 @@ end
|
|
201
208
|
|
202
209
|
@store.complete :public
|
203
210
|
|
204
|
-
refute_match %r%^class Object$%, @s.report
|
211
|
+
refute_match %r%^class Object$%, @s.report.accept(to_rdoc)
|
205
212
|
end
|
206
213
|
|
207
214
|
def test_report_class_documented
|
@@ -245,16 +252,16 @@ end
|
|
245
252
|
|
246
253
|
report = @s.report
|
247
254
|
|
248
|
-
expected =
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
end
|
257
|
-
|
255
|
+
expected =
|
256
|
+
doc(
|
257
|
+
para('The following items are not documented:'),
|
258
|
+
blank_line,
|
259
|
+
para('In files:'),
|
260
|
+
list(:BULLET, *[
|
261
|
+
item(nil, para('file.rb'))]),
|
262
|
+
blank_line,
|
263
|
+
verb("class C2\n", "end\n"),
|
264
|
+
blank_line)
|
258
265
|
|
259
266
|
assert_equal expected, report
|
260
267
|
end
|
@@ -266,13 +273,13 @@ end
|
|
266
273
|
|
267
274
|
report = @s.report
|
268
275
|
|
269
|
-
expected =
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
+
expected =
|
277
|
+
doc(
|
278
|
+
para('The following items are not documented:'),
|
279
|
+
blank_line,
|
280
|
+
para('class C is referenced but empty.'),
|
281
|
+
para("It probably came from another project. I'm sorry I'm holding it against you."),
|
282
|
+
blank_line)
|
276
283
|
|
277
284
|
assert_equal expected, report
|
278
285
|
end
|
@@ -290,16 +297,16 @@ The following items are not documented:
|
|
290
297
|
@s.coverage_level = 1
|
291
298
|
report = @s.report
|
292
299
|
|
293
|
-
expected =
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
300
|
+
expected =
|
301
|
+
doc(
|
302
|
+
para('The following items are not documented:'),
|
303
|
+
blank_line,
|
304
|
+
para('In files:'),
|
305
|
+
list(:BULLET, *[
|
306
|
+
item(nil, para('file.rb'))]),
|
307
|
+
blank_line,
|
308
|
+
verb("class C1\n", "end\n"),
|
309
|
+
blank_line)
|
303
310
|
|
304
311
|
assert_equal expected, report
|
305
312
|
end
|
@@ -317,15 +324,16 @@ end
|
|
317
324
|
|
318
325
|
report = @s.report
|
319
326
|
|
320
|
-
expected =
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
327
|
+
expected =
|
328
|
+
doc(
|
329
|
+
para('The following items are not documented:'),
|
330
|
+
blank_line,
|
331
|
+
para('In files:'),
|
332
|
+
list(:BULLET, *[
|
333
|
+
item(nil, para('file.rb'))]),
|
334
|
+
blank_line,
|
335
|
+
verb("class C\n", "end\n"),
|
336
|
+
blank_line)
|
329
337
|
|
330
338
|
assert_equal expected, report
|
331
339
|
end
|
@@ -367,16 +375,18 @@ end
|
|
367
375
|
|
368
376
|
report = @s.report
|
369
377
|
|
370
|
-
expected =
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
end
|
379
|
-
|
378
|
+
expected =
|
379
|
+
doc(
|
380
|
+
para('The following items are not documented:'),
|
381
|
+
blank_line,
|
382
|
+
verb(*[
|
383
|
+
"class C # is documented\n",
|
384
|
+
"\n",
|
385
|
+
" # in file file.rb\n",
|
386
|
+
" def m1; end\n",
|
387
|
+
"\n",
|
388
|
+
"end\n"]),
|
389
|
+
blank_line)
|
380
390
|
|
381
391
|
assert_equal expected, report
|
382
392
|
end
|
@@ -401,16 +411,18 @@ end
|
|
401
411
|
|
402
412
|
report = @s.report
|
403
413
|
|
404
|
-
expected =
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
end
|
413
|
-
|
414
|
+
expected =
|
415
|
+
doc(
|
416
|
+
para('The following items are not documented:'),
|
417
|
+
blank_line,
|
418
|
+
verb(*[
|
419
|
+
"class C # is documented\n",
|
420
|
+
"\n",
|
421
|
+
" # in file file.rb\n",
|
422
|
+
" def self.m1; end\n",
|
423
|
+
"\n",
|
424
|
+
"end\n"]),
|
425
|
+
blank_line)
|
414
426
|
|
415
427
|
assert_equal expected, report
|
416
428
|
end
|
@@ -444,7 +456,7 @@ end
|
|
444
456
|
|
445
457
|
@store.complete :public
|
446
458
|
|
447
|
-
assert_match '# in file file.rb:4', @s.report
|
459
|
+
assert_match '# in file file.rb:4', @s.report.accept(to_rdoc)
|
448
460
|
end
|
449
461
|
|
450
462
|
def test_report_method_parameters
|
@@ -468,17 +480,19 @@ end
|
|
468
480
|
@s.coverage_level = 1
|
469
481
|
report = @s.report
|
470
482
|
|
471
|
-
expected =
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
end
|
481
|
-
|
483
|
+
expected =
|
484
|
+
doc(
|
485
|
+
para('The following items are not documented:'),
|
486
|
+
blank_line,
|
487
|
+
verb(*[
|
488
|
+
"class C # is documented\n",
|
489
|
+
"\n",
|
490
|
+
" # in file file.rb\n",
|
491
|
+
" # +p2+ is not documented\n",
|
492
|
+
" def m1(p1, p2); end\n",
|
493
|
+
"\n",
|
494
|
+
"end\n"]),
|
495
|
+
blank_line)
|
482
496
|
|
483
497
|
assert_equal expected, report
|
484
498
|
end
|
@@ -522,17 +536,19 @@ m(a, b) { |c, d| ... }
|
|
522
536
|
@s.coverage_level = 1
|
523
537
|
report = @s.report
|
524
538
|
|
525
|
-
expected =
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
end
|
535
|
-
|
539
|
+
expected =
|
540
|
+
doc(
|
541
|
+
para('The following items are not documented:'),
|
542
|
+
blank_line,
|
543
|
+
verb(
|
544
|
+
"class C # is documented\n",
|
545
|
+
"\n",
|
546
|
+
" # in file file.rb\n",
|
547
|
+
" # +b+, +d+ is not documented\n",
|
548
|
+
" def m; end\n",
|
549
|
+
"\n",
|
550
|
+
"end\n"),
|
551
|
+
blank_line)
|
536
552
|
|
537
553
|
assert_equal expected, report
|
538
554
|
end
|
@@ -558,20 +574,20 @@ end
|
|
558
574
|
|
559
575
|
@store.complete :public
|
560
576
|
|
561
|
-
summary = @s.summary
|
562
|
-
summary.sub!(/Elapsed
|
577
|
+
summary = @s.summary.accept to_rdoc
|
578
|
+
summary.sub!(/ Elapsed:.*/m, '')
|
563
579
|
|
564
580
|
expected = <<-EXPECTED
|
565
|
-
Files: 0
|
581
|
+
Files: 0
|
566
582
|
|
567
|
-
Classes: 1 (1 undocumented)
|
568
|
-
Modules: 1 (1 undocumented)
|
569
|
-
Constants: 1 (1 undocumented)
|
570
|
-
Attributes: 1 (1 undocumented)
|
571
|
-
Methods: 1 (1 undocumented)
|
583
|
+
Classes: 1 (1 undocumented)
|
584
|
+
Modules: 1 (1 undocumented)
|
585
|
+
Constants: 1 (1 undocumented)
|
586
|
+
Attributes: 1 (1 undocumented)
|
587
|
+
Methods: 1 (1 undocumented)
|
572
588
|
|
573
|
-
Total: 5 (5 undocumented)
|
574
|
-
|
589
|
+
Total: 5 (5 undocumented)
|
590
|
+
0.00% documented
|
575
591
|
|
576
592
|
EXPECTED
|
577
593
|
|
@@ -586,20 +602,20 @@ Total: 5 (5 undocumented)
|
|
586
602
|
|
587
603
|
@s.coverage_level = false
|
588
604
|
|
589
|
-
summary = @s.summary
|
590
|
-
summary.sub!(/Elapsed
|
605
|
+
summary = @s.summary.accept to_rdoc
|
606
|
+
summary.sub!(/ Elapsed:.*/m, '')
|
591
607
|
|
592
608
|
expected = <<-EXPECTED
|
593
|
-
Files: 0
|
609
|
+
Files: 0
|
594
610
|
|
595
|
-
Classes: 1 (1 undocumented)
|
596
|
-
Modules: 0 (0 undocumented)
|
597
|
-
Constants: 0 (0 undocumented)
|
598
|
-
Attributes: 0 (0 undocumented)
|
599
|
-
Methods: 0 (0 undocumented)
|
611
|
+
Classes: 1 (1 undocumented)
|
612
|
+
Modules: 0 (0 undocumented)
|
613
|
+
Constants: 0 (0 undocumented)
|
614
|
+
Attributes: 0 (0 undocumented)
|
615
|
+
Methods: 0 (0 undocumented)
|
600
616
|
|
601
|
-
Total: 1 (1 undocumented)
|
602
|
-
|
617
|
+
Total: 1 (1 undocumented)
|
618
|
+
0.00% documented
|
603
619
|
|
604
620
|
EXPECTED
|
605
621
|
|
@@ -622,26 +638,30 @@ Total: 1 (1 undocumented)
|
|
622
638
|
@s.coverage_level = 1
|
623
639
|
@s.report
|
624
640
|
|
625
|
-
summary = @s.summary
|
626
|
-
summary.sub!(/Elapsed
|
641
|
+
summary = @s.summary.accept to_rdoc
|
642
|
+
summary.sub!(/ Elapsed:.*/m, '')
|
627
643
|
|
628
644
|
expected = <<-EXPECTED
|
629
|
-
Files: 0
|
645
|
+
Files: 0
|
630
646
|
|
631
|
-
Classes: 1 (0 undocumented)
|
632
|
-
Modules: 0 (0 undocumented)
|
633
|
-
Constants: 0 (0 undocumented)
|
634
|
-
Attributes: 0 (0 undocumented)
|
635
|
-
Methods: 1 (0 undocumented)
|
636
|
-
Parameters: 2 (1 undocumented)
|
647
|
+
Classes: 1 (0 undocumented)
|
648
|
+
Modules: 0 (0 undocumented)
|
649
|
+
Constants: 0 (0 undocumented)
|
650
|
+
Attributes: 0 (0 undocumented)
|
651
|
+
Methods: 1 (0 undocumented)
|
652
|
+
Parameters: 2 (1 undocumented)
|
637
653
|
|
638
|
-
Total: 4 (1 undocumented)
|
639
|
-
|
654
|
+
Total: 4 (1 undocumented)
|
655
|
+
75.00% documented
|
640
656
|
|
641
657
|
EXPECTED
|
642
658
|
|
643
659
|
assert_equal summary, expected
|
644
660
|
end
|
645
661
|
|
662
|
+
def to_rdoc
|
663
|
+
RDoc::Markup::ToRdoc.new
|
664
|
+
end
|
665
|
+
|
646
666
|
end
|
647
667
|
|