rdoc 3.12.2 → 4.0.0.preview2
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 +6 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +3 -2
- data/DEVELOPERS.rdoc +53 -0
- data/History.rdoc +159 -25
- data/LEGAL.rdoc +12 -0
- data/Manifest.txt +56 -3
- data/README.rdoc +87 -19
- data/Rakefile +11 -2
- data/TODO.rdoc +20 -13
- data/bin/rdoc +4 -0
- data/lib/gauntlet_rdoc.rb +1 -1
- data/lib/rdoc.rb +32 -71
- data/lib/rdoc/any_method.rb +75 -21
- data/lib/rdoc/attr.rb +49 -10
- data/lib/rdoc/class_module.rb +182 -32
- data/lib/rdoc/code_object.rb +54 -12
- data/lib/rdoc/comment.rb +8 -1
- data/lib/rdoc/constant.rb +100 -6
- data/lib/rdoc/context.rb +93 -41
- data/lib/rdoc/context/section.rb +143 -28
- data/lib/rdoc/cross_reference.rb +58 -50
- data/lib/rdoc/encoding.rb +34 -29
- data/lib/rdoc/erb_partial.rb +18 -0
- data/lib/rdoc/extend.rb +117 -0
- data/lib/rdoc/generator.rb +11 -6
- data/lib/rdoc/generator/darkfish.rb +250 -62
- data/lib/rdoc/generator/json_index.rb +20 -12
- data/lib/rdoc/generator/markup.rb +10 -12
- data/lib/rdoc/generator/ri.rb +7 -60
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +16 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +14 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +13 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -1
- data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -9
- data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -0
- data/lib/rdoc/generator/template/darkfish/rdoc.css +31 -0
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +18 -0
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +37 -0
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
- data/lib/rdoc/include.rb +12 -3
- data/lib/rdoc/markdown.kpeg +1186 -0
- data/lib/rdoc/markdown.rb +16336 -0
- data/lib/rdoc/markdown/entities.rb +2128 -0
- data/lib/rdoc/markdown/literals_1_8.kpeg +18 -0
- data/lib/rdoc/markdown/literals_1_8.rb +454 -0
- data/lib/rdoc/markdown/literals_1_9.kpeg +22 -0
- data/lib/rdoc/markdown/literals_1_9.rb +417 -0
- data/lib/rdoc/markup.rb +69 -10
- data/lib/rdoc/markup/attr_changer.rb +2 -5
- data/lib/rdoc/markup/attribute_manager.rb +23 -14
- data/lib/rdoc/markup/attributes.rb +70 -0
- data/lib/rdoc/markup/block_quote.rb +14 -0
- data/lib/rdoc/markup/document.rb +20 -4
- data/lib/rdoc/markup/formatter.rb +17 -6
- data/lib/rdoc/markup/formatter_test_case.rb +93 -24
- data/lib/rdoc/markup/hard_break.rb +31 -0
- data/lib/rdoc/markup/heading.rb +1 -1
- data/lib/rdoc/markup/indented_paragraph.rb +14 -0
- data/lib/rdoc/markup/list.rb +23 -4
- data/lib/rdoc/markup/list_item.rb +17 -4
- data/lib/rdoc/markup/paragraph.rb +14 -0
- data/lib/rdoc/markup/parser.rb +107 -60
- data/lib/rdoc/markup/raw.rb +4 -4
- data/lib/rdoc/markup/special.rb +3 -3
- data/lib/rdoc/markup/to_ansi.rb +7 -1
- data/lib/rdoc/markup/to_html.rb +42 -14
- data/lib/rdoc/markup/to_html_crossref.rb +10 -9
- data/lib/rdoc/markup/to_html_snippet.rb +20 -4
- data/lib/rdoc/markup/to_joined_paragraph.rb +68 -0
- data/lib/rdoc/markup/to_label.rb +20 -1
- data/lib/rdoc/markup/to_markdown.rb +134 -0
- data/lib/rdoc/markup/to_rdoc.rb +36 -5
- data/lib/rdoc/markup/to_table_of_contents.rb +6 -1
- data/lib/rdoc/markup/to_tt_only.rb +11 -2
- data/lib/rdoc/markup/verbatim.rb +19 -0
- data/lib/rdoc/method_attr.rb +33 -19
- data/lib/rdoc/normal_class.rb +26 -7
- data/lib/rdoc/normal_module.rb +10 -5
- data/lib/rdoc/options.rb +95 -21
- data/lib/rdoc/parser.rb +6 -2
- data/lib/rdoc/parser/c.rb +212 -97
- data/lib/rdoc/parser/markdown.rb +23 -0
- data/lib/rdoc/parser/ruby.rb +115 -35
- data/lib/rdoc/parser/ruby_tools.rb +8 -3
- data/lib/rdoc/rd.rb +8 -4
- data/lib/rdoc/rd/block_parser.rb +1 -1
- data/lib/rdoc/rd/block_parser.ry +1 -1
- data/lib/rdoc/rdoc.rb +45 -21
- data/lib/rdoc/ri/driver.rb +322 -76
- data/lib/rdoc/ri/paths.rb +90 -31
- data/lib/rdoc/ri/store.rb +2 -353
- data/lib/rdoc/ruby_lex.rb +5 -21
- data/lib/rdoc/ruby_token.rb +2 -3
- data/lib/rdoc/rubygems_hook.rb +21 -9
- data/lib/rdoc/servlet.rb +302 -0
- data/lib/rdoc/stats.rb +28 -20
- data/lib/rdoc/store.rb +881 -0
- data/lib/rdoc/task.rb +2 -1
- data/lib/rdoc/test_case.rb +103 -1
- data/lib/rdoc/text.rb +5 -4
- data/lib/rdoc/tom_doc.rb +17 -16
- data/lib/rdoc/top_level.rb +43 -285
- data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +21 -0
- data/test/MarkdownTest_1.0.3/Auto links.text +13 -0
- data/test/MarkdownTest_1.0.3/Backslash escapes.text +120 -0
- data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +11 -0
- data/test/MarkdownTest_1.0.3/Code Blocks.text +14 -0
- data/test/MarkdownTest_1.0.3/Code Spans.text +6 -0
- data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/test/MarkdownTest_1.0.3/Horizontal rules.text +67 -0
- data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +15 -0
- data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +69 -0
- data/test/MarkdownTest_1.0.3/Inline HTML comments.text +13 -0
- data/test/MarkdownTest_1.0.3/Links, inline style.text +12 -0
- data/test/MarkdownTest_1.0.3/Links, reference style.text +71 -0
- data/test/MarkdownTest_1.0.3/Links, shortcut references.text +20 -0
- data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +7 -0
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +306 -0
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +888 -0
- data/test/MarkdownTest_1.0.3/Nested blockquotes.text +5 -0
- data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +131 -0
- data/test/MarkdownTest_1.0.3/Strong and em together.text +7 -0
- data/test/MarkdownTest_1.0.3/Tabs.text +21 -0
- data/test/MarkdownTest_1.0.3/Tidyness.text +5 -0
- data/test/test_attribute_manager.rb +7 -4
- data/test/test_rdoc_any_method.rb +84 -13
- data/test/test_rdoc_attr.rb +59 -9
- data/test/test_rdoc_class_module.rb +670 -73
- data/test/test_rdoc_code_object.rb +21 -1
- data/test/test_rdoc_comment.rb +1 -1
- data/test/test_rdoc_constant.rb +132 -0
- data/test/test_rdoc_context.rb +84 -18
- data/test/test_rdoc_context_section.rb +99 -15
- data/test/test_rdoc_cross_reference.rb +1 -1
- data/test/test_rdoc_encoding.rb +17 -1
- data/test/test_rdoc_extend.rb +94 -0
- data/test/test_rdoc_generator_darkfish.rb +45 -19
- data/test/test_rdoc_generator_json_index.rb +27 -7
- data/test/test_rdoc_generator_markup.rb +3 -3
- data/test/test_rdoc_generator_ri.rb +11 -9
- data/test/test_rdoc_include.rb +12 -0
- data/test/test_rdoc_markdown.rb +977 -0
- data/test/test_rdoc_markdown_test.rb +1891 -0
- data/test/test_rdoc_markup.rb +1 -1
- data/test/test_rdoc_markup_attribute_manager.rb +2 -2
- data/test/test_rdoc_markup_attributes.rb +39 -0
- data/test/test_rdoc_markup_document.rb +16 -1
- data/test/test_rdoc_markup_formatter.rb +7 -4
- data/test/test_rdoc_markup_hard_break.rb +31 -0
- data/test/test_rdoc_markup_indented_paragraph.rb +14 -0
- data/test/test_rdoc_markup_paragraph.rb +15 -1
- data/test/test_rdoc_markup_parser.rb +152 -89
- data/test/test_rdoc_markup_to_ansi.rb +23 -2
- data/test/test_rdoc_markup_to_bs.rb +24 -0
- data/test/test_rdoc_markup_to_html.rb +50 -19
- data/test/test_rdoc_markup_to_html_crossref.rb +23 -5
- data/test/test_rdoc_markup_to_html_snippet.rb +49 -8
- data/test/test_rdoc_markup_to_joined_paragraph.rb +32 -0
- data/test/test_rdoc_markup_to_label.rb +63 -1
- data/test/test_rdoc_markup_to_markdown.rb +352 -0
- data/test/test_rdoc_markup_to_rdoc.rb +22 -2
- data/test/test_rdoc_markup_to_table_of_contents.rb +44 -39
- data/test/test_rdoc_markup_to_tt_only.rb +20 -0
- data/test/test_rdoc_markup_verbatim.rb +13 -0
- data/test/test_rdoc_method_attr.rb +5 -0
- data/test/test_rdoc_normal_class.rb +24 -5
- data/test/test_rdoc_normal_module.rb +1 -1
- data/test/test_rdoc_options.rb +21 -6
- data/test/test_rdoc_parser.rb +24 -0
- data/test/test_rdoc_parser_c.rb +151 -26
- data/test/test_rdoc_parser_markdown.rb +55 -0
- data/test/test_rdoc_parser_rd.rb +2 -2
- data/test/test_rdoc_parser_ruby.rb +468 -109
- data/test/test_rdoc_parser_simple.rb +2 -2
- data/test/test_rdoc_rd_block_parser.rb +0 -4
- data/test/test_rdoc_rdoc.rb +110 -22
- data/test/test_rdoc_ri_driver.rb +415 -80
- data/test/test_rdoc_ri_paths.rb +122 -13
- data/test/test_rdoc_ruby_lex.rb +5 -61
- data/test/test_rdoc_ruby_token.rb +19 -0
- data/test/test_rdoc_rubygems_hook.rb +64 -43
- data/test/test_rdoc_servlet.rb +429 -0
- data/test/test_rdoc_stats.rb +83 -24
- data/test/{test_rdoc_ri_store.rb → test_rdoc_store.rb} +395 -22
- data/test/test_rdoc_task.rb +2 -2
- data/test/test_rdoc_text.rb +37 -11
- data/test/test_rdoc_tom_doc.rb +59 -62
- data/test/test_rdoc_top_level.rb +71 -113
- data/test/xref_test_case.rb +7 -9
- metadata +122 -39
- metadata.gz.sig +0 -0
- data/CVE-2013-0256.rdoc +0 -49
- data/lib/rdoc/markup/attribute.rb +0 -51
@@ -46,45 +46,50 @@ class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase
|
|
46
46
|
assert_equal [@RM::Heading.new(1, '\\Hello')], @to.res
|
47
47
|
end
|
48
48
|
|
49
|
-
alias accept_blank_line
|
50
|
-
alias
|
51
|
-
alias
|
52
|
-
alias
|
53
|
-
alias
|
54
|
-
alias
|
55
|
-
alias
|
56
|
-
alias
|
57
|
-
alias
|
58
|
-
alias
|
59
|
-
alias
|
60
|
-
alias
|
61
|
-
alias
|
62
|
-
alias
|
63
|
-
alias
|
64
|
-
alias
|
65
|
-
alias
|
66
|
-
alias
|
67
|
-
alias
|
68
|
-
alias
|
69
|
-
alias
|
70
|
-
alias
|
71
|
-
alias
|
72
|
-
alias
|
73
|
-
alias
|
74
|
-
alias
|
75
|
-
alias
|
76
|
-
alias
|
77
|
-
alias
|
78
|
-
alias
|
79
|
-
alias
|
80
|
-
alias
|
81
|
-
alias
|
82
|
-
alias
|
83
|
-
alias
|
84
|
-
alias
|
85
|
-
alias
|
86
|
-
alias
|
87
|
-
alias
|
49
|
+
alias accept_blank_line empty
|
50
|
+
alias accept_block_quote empty
|
51
|
+
alias accept_document empty
|
52
|
+
alias accept_list_end_bullet empty
|
53
|
+
alias accept_list_end_label empty
|
54
|
+
alias accept_list_end_lalpha empty
|
55
|
+
alias accept_list_end_note empty
|
56
|
+
alias accept_list_end_number empty
|
57
|
+
alias accept_list_end_ualpha empty
|
58
|
+
alias accept_list_item_end_bullet empty
|
59
|
+
alias accept_list_item_end_label empty
|
60
|
+
alias accept_list_item_end_lalpha empty
|
61
|
+
alias accept_list_item_end_note empty
|
62
|
+
alias accept_list_item_end_number empty
|
63
|
+
alias accept_list_item_end_ualpha empty
|
64
|
+
alias accept_list_item_start_bullet empty
|
65
|
+
alias accept_list_item_start_label empty
|
66
|
+
alias accept_list_item_start_lalpha empty
|
67
|
+
alias accept_list_item_start_note empty
|
68
|
+
alias accept_list_item_start_note_2 empty
|
69
|
+
alias accept_list_item_start_note_multi_description empty
|
70
|
+
alias accept_list_item_start_note_multi_label empty
|
71
|
+
alias accept_list_item_start_number empty
|
72
|
+
alias accept_list_item_start_ualpha empty
|
73
|
+
alias accept_list_start_bullet empty
|
74
|
+
alias accept_list_start_label empty
|
75
|
+
alias accept_list_start_lalpha empty
|
76
|
+
alias accept_list_start_note empty
|
77
|
+
alias accept_list_start_number empty
|
78
|
+
alias accept_list_start_ualpha empty
|
79
|
+
alias accept_paragraph empty
|
80
|
+
alias accept_paragraph_b empty
|
81
|
+
alias accept_paragraph_br empty
|
82
|
+
alias accept_paragraph_break empty
|
83
|
+
alias accept_paragraph_i empty
|
84
|
+
alias accept_paragraph_plus empty
|
85
|
+
alias accept_paragraph_star empty
|
86
|
+
alias accept_paragraph_underscore empty
|
87
|
+
alias accept_raw empty
|
88
|
+
alias accept_rule empty
|
89
|
+
alias accept_verbatim empty
|
90
|
+
alias list_nested empty
|
91
|
+
alias list_verbatim empty
|
92
|
+
alias start_accepting empty
|
88
93
|
|
89
94
|
end
|
90
95
|
|
@@ -14,6 +14,10 @@ class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
|
|
14
14
|
assert_empty @to.end_accepting
|
15
15
|
end
|
16
16
|
|
17
|
+
def accept_block_quote
|
18
|
+
assert_empty @to.end_accepting
|
19
|
+
end
|
20
|
+
|
17
21
|
def accept_document
|
18
22
|
assert_equal [], @to.res
|
19
23
|
end
|
@@ -122,6 +126,10 @@ class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
|
|
122
126
|
assert_empty @to.end_accepting
|
123
127
|
end
|
124
128
|
|
129
|
+
def accept_paragraph_break
|
130
|
+
assert_empty @to.end_accepting
|
131
|
+
end
|
132
|
+
|
125
133
|
def accept_raw
|
126
134
|
assert_empty @to.end_accepting
|
127
135
|
end
|
@@ -174,10 +182,22 @@ class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
|
|
174
182
|
assert_equal [nil, 'teletype', nil], @to.res
|
175
183
|
end
|
176
184
|
|
185
|
+
def accept_list_item_start_note_multi_description
|
186
|
+
assert_empty @to.res
|
187
|
+
end
|
188
|
+
|
189
|
+
def accept_list_item_start_note_multi_label
|
190
|
+
assert_empty @to.res
|
191
|
+
end
|
192
|
+
|
177
193
|
def accept_paragraph_b
|
178
194
|
assert_empty @to.end_accepting
|
179
195
|
end
|
180
196
|
|
197
|
+
def accept_paragraph_br
|
198
|
+
assert_empty @to.end_accepting
|
199
|
+
end
|
200
|
+
|
181
201
|
def accept_paragraph_i
|
182
202
|
assert_empty @to.end_accepting
|
183
203
|
end
|
@@ -2,6 +2,19 @@ require 'rdoc/test_case'
|
|
2
2
|
|
3
3
|
class TestRDocMarkupVerbatim < RDoc::TestCase
|
4
4
|
|
5
|
+
def test_equals2
|
6
|
+
v1 = verb('1 + 1')
|
7
|
+
v2 = verb('1 + 1')
|
8
|
+
v3 = verb('1 + 2')
|
9
|
+
v4 = verb('1 + 1')
|
10
|
+
v4.format = :ruby
|
11
|
+
|
12
|
+
assert_equal v1, v2
|
13
|
+
|
14
|
+
refute_equal v1, v3
|
15
|
+
refute_equal v1, v4
|
16
|
+
end
|
17
|
+
|
5
18
|
def test_ruby_eh
|
6
19
|
verbatim = RDoc::Markup::Verbatim.new
|
7
20
|
|
@@ -140,6 +140,11 @@ class TestRDocMethodAttr < XrefTestCase
|
|
140
140
|
assert_equal expected, @c1_m.search_record
|
141
141
|
end
|
142
142
|
|
143
|
+
def test_equals2
|
144
|
+
assert_equal @c1_m, @c1_m
|
145
|
+
refute_equal @c1_m, @parent_m
|
146
|
+
end
|
147
|
+
|
143
148
|
def test_to_s
|
144
149
|
assert_equal 'RDoc::AnyMethod: C1#m', @c1_m.to_s
|
145
150
|
assert_equal 'RDoc::AnyMethod: C2#b', @c2_b.to_s
|
@@ -2,15 +2,34 @@ require File.expand_path '../xref_test_case', __FILE__
|
|
2
2
|
|
3
3
|
class TestRDocNormalClass < XrefTestCase
|
4
4
|
|
5
|
-
def
|
6
|
-
|
7
|
-
klass = top_level.add_class RDoc::NormalClass, 'Klass'
|
5
|
+
def test_ancestors
|
6
|
+
klass = @top_level.add_class RDoc::NormalClass, 'Klass'
|
8
7
|
incl = RDoc::Include.new 'Incl', ''
|
9
8
|
|
10
|
-
sub_klass =
|
9
|
+
sub_klass = @top_level.add_class RDoc::NormalClass, 'SubClass'
|
10
|
+
sub_klass.superclass = klass
|
11
11
|
sub_klass.add_include incl
|
12
12
|
|
13
|
-
assert_equal [incl.name, klass], sub_klass.ancestors
|
13
|
+
assert_equal [incl.name, klass, 'Object'], sub_klass.ancestors
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_ancestors_multilevel
|
17
|
+
c1 = @top_level.add_class RDoc::NormalClass, 'Outer'
|
18
|
+
c2 = @top_level.add_class RDoc::NormalClass, 'Middle', c1
|
19
|
+
c3 = @top_level.add_class RDoc::NormalClass, 'Inner', c2
|
20
|
+
|
21
|
+
assert_equal [c2, c1, 'Object'], c3.ancestors
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_direct_ancestors
|
25
|
+
incl = RDoc::Include.new 'Incl', ''
|
26
|
+
|
27
|
+
c1 = @top_level.add_class RDoc::NormalClass, 'Outer'
|
28
|
+
c2 = @top_level.add_class RDoc::NormalClass, 'Middle', c1
|
29
|
+
c3 = @top_level.add_class RDoc::NormalClass, 'Inner', c2
|
30
|
+
c3.add_include incl
|
31
|
+
|
32
|
+
assert_equal [incl.name, c2], c3.direct_ancestors
|
14
33
|
end
|
15
34
|
|
16
35
|
def test_definition
|
data/test/test_rdoc_options.rb
CHANGED
@@ -45,7 +45,7 @@ class TestRDocOptions < RDoc::TestCase
|
|
45
45
|
def test_check_files_warn
|
46
46
|
@options.verbosity = 2
|
47
47
|
|
48
|
-
out, err =
|
48
|
+
out, err = verbose_capture_io do
|
49
49
|
@options.files = %w[nonexistent]
|
50
50
|
|
51
51
|
@options.check_files
|
@@ -124,7 +124,7 @@ class TestRDocOptions < RDoc::TestCase
|
|
124
124
|
def test_encoding_default
|
125
125
|
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
126
126
|
|
127
|
-
assert_equal Encoding
|
127
|
+
assert_equal Encoding::UTF_8, @options.encoding
|
128
128
|
end
|
129
129
|
|
130
130
|
def test_generator_descriptions
|
@@ -195,7 +195,9 @@ rdoc_include:
|
|
195
195
|
def test_parse_copy_files_directory_absolute
|
196
196
|
@options.parse %w[--copy-files /]
|
197
197
|
|
198
|
-
assert_equal
|
198
|
+
assert_equal 1, @options.static_path.length
|
199
|
+
|
200
|
+
assert_match %r%^([A-Z]:)?/$%i, @options.static_path.first
|
199
201
|
end
|
200
202
|
|
201
203
|
def test_parse_coverage
|
@@ -428,6 +430,19 @@ rdoc_include:
|
|
428
430
|
assert_equal 'tomdoc', @options.markup
|
429
431
|
end
|
430
432
|
|
433
|
+
def test_parse_root
|
434
|
+
assert_equal Pathname(Dir.pwd), @options.root
|
435
|
+
|
436
|
+
out, err = capture_io do
|
437
|
+
@options.parse %W[--root #{Dir.tmpdir}]
|
438
|
+
end
|
439
|
+
|
440
|
+
assert_empty out
|
441
|
+
assert_empty err
|
442
|
+
|
443
|
+
assert_equal Pathname(Dir.tmpdir), @options.root
|
444
|
+
end
|
445
|
+
|
431
446
|
def test_parse_template
|
432
447
|
out, err = capture_io do
|
433
448
|
@options.parse %w[--template darkfish]
|
@@ -489,7 +504,7 @@ rdoc_include:
|
|
489
504
|
end
|
490
505
|
|
491
506
|
assert_equal 0, e.status
|
492
|
-
|
507
|
+
|
493
508
|
assert File.exist? '.rdoc_options'
|
494
509
|
end
|
495
510
|
ensure
|
@@ -557,7 +572,7 @@ rdoc_include:
|
|
557
572
|
|
558
573
|
@options.verbosity = 2
|
559
574
|
|
560
|
-
out, err =
|
575
|
+
out, err = verbose_capture_io do
|
561
576
|
@options.warn "warnings on"
|
562
577
|
end
|
563
578
|
|
@@ -568,7 +583,7 @@ rdoc_include:
|
|
568
583
|
def test_write_options
|
569
584
|
temp_dir do |dir|
|
570
585
|
@options.write_options
|
571
|
-
|
586
|
+
|
572
587
|
assert File.exist? '.rdoc_options'
|
573
588
|
|
574
589
|
assert_equal @options, YAML.load(File.read('.rdoc_options'))
|
data/test/test_rdoc_parser.rb
CHANGED
@@ -61,6 +61,20 @@ class TestRDocParser < RDoc::TestCase
|
|
61
61
|
assert_equal @RP::Simple, @RP.can_parse(readme_file_name)
|
62
62
|
end
|
63
63
|
|
64
|
+
def test_class_can_parse_forbidden
|
65
|
+
skip 'chmod not supported' if Gem.win_platform?
|
66
|
+
|
67
|
+
Tempfile.open 'forbidden' do |io|
|
68
|
+
begin
|
69
|
+
File.chmod 0000, io.path
|
70
|
+
|
71
|
+
assert_nil @RP.can_parse io.path
|
72
|
+
ensure
|
73
|
+
File.chmod 0400, io.path
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
64
78
|
##
|
65
79
|
# Selenium hides a .jar file using a .txt extension.
|
66
80
|
|
@@ -101,6 +115,16 @@ class TestRDocParser < RDoc::TestCase
|
|
101
115
|
assert_equal @RP::RD, parser
|
102
116
|
end
|
103
117
|
|
118
|
+
def test_class_use_markup_markdown
|
119
|
+
content = <<-CONTENT
|
120
|
+
# coding: utf-8 markup: markdown
|
121
|
+
CONTENT
|
122
|
+
|
123
|
+
parser = @RP.use_markup content
|
124
|
+
|
125
|
+
assert_equal @RP::Ruby, parser
|
126
|
+
end
|
127
|
+
|
104
128
|
def test_class_use_markup_modeline
|
105
129
|
content = <<-CONTENT
|
106
130
|
# -*- coding: utf-8 -*-
|
data/test/test_rdoc_parser_c.rb
CHANGED
@@ -54,11 +54,11 @@ class TestRDocParserC < RDoc::TestCase
|
|
54
54
|
@tempfile = Tempfile.new self.class.name
|
55
55
|
filename = @tempfile.path
|
56
56
|
|
57
|
-
@top_level =
|
57
|
+
@top_level = @store.add_file filename
|
58
58
|
@fn = filename
|
59
59
|
@options = RDoc::Options.new
|
60
60
|
@options.verbosity = 2
|
61
|
-
@stats = RDoc::Stats.new 0
|
61
|
+
@stats = RDoc::Stats.new @store, 0
|
62
62
|
end
|
63
63
|
|
64
64
|
def teardown
|
@@ -244,11 +244,11 @@ void Init_Blah(void) {
|
|
244
244
|
}
|
245
245
|
EOF
|
246
246
|
|
247
|
-
_, err =
|
247
|
+
_, err = verbose_capture_io do
|
248
248
|
refute util_get_class(content, 'cDate')
|
249
249
|
end
|
250
250
|
|
251
|
-
assert_equal "Enclosing class
|
251
|
+
assert_equal "Enclosing class or module \"cDate\" for alias b a is not known\n",
|
252
252
|
err
|
253
253
|
end
|
254
254
|
|
@@ -388,6 +388,12 @@ void Init_foo(){
|
|
388
388
|
*/
|
389
389
|
rb_define_const(cFoo, "MULTILINE_NOT_EMPTY", INT2FIX(1));
|
390
390
|
|
391
|
+
/*
|
392
|
+
* Multiline comment goes here because this comment spans multiple lines.
|
393
|
+
* 1: However, the value extraction should only happen for the first line
|
394
|
+
*/
|
395
|
+
rb_define_const(cFoo, "MULTILINE_COLON_ON_SECOND_LINE", INT2FIX(1));
|
396
|
+
|
391
397
|
}
|
392
398
|
EOF
|
393
399
|
|
@@ -437,6 +443,13 @@ Multiline comment goes here because this comment spans multiple lines.
|
|
437
443
|
assert_equal ['MULTILINE_VALUE', '1', comment], constants.shift
|
438
444
|
assert_equal ['MULTILINE_NOT_EMPTY', 'INT2FIX(1)', comment], constants.shift
|
439
445
|
|
446
|
+
comment = <<-EOF.chomp
|
447
|
+
Multiline comment goes here because this comment spans multiple lines.
|
448
|
+
1: However, the value extraction should only happen for the first line
|
449
|
+
EOF
|
450
|
+
assert_equal ['MULTILINE_COLON_ON_SECOND_LINE', 'INT2FIX(1)', comment],
|
451
|
+
constants.shift
|
452
|
+
|
440
453
|
assert constants.empty?, constants.inspect
|
441
454
|
end
|
442
455
|
|
@@ -456,6 +469,7 @@ void Init_curses(){
|
|
456
469
|
|
457
470
|
@parser = util_parser content
|
458
471
|
|
472
|
+
@parser.do_modules
|
459
473
|
@parser.do_classes
|
460
474
|
@parser.do_constants
|
461
475
|
|
@@ -469,6 +483,39 @@ void Init_curses(){
|
|
469
483
|
assert_equal 'Value of the color black', constants.first.comment.text
|
470
484
|
end
|
471
485
|
|
486
|
+
def test_do_constants_file
|
487
|
+
content = <<-EOF
|
488
|
+
void Init_File(void) {
|
489
|
+
rb_cFile = rb_define_class("File", rb_cIO);
|
490
|
+
rb_mFConst = rb_define_module_under(rb_cFile, "Constants");
|
491
|
+
rb_include_module(rb_cIO, rb_mFConst);
|
492
|
+
|
493
|
+
/* Document-const: LOCK_SH
|
494
|
+
*
|
495
|
+
* Shared lock
|
496
|
+
*/
|
497
|
+
rb_file_const("LOCK_SH", INT2FIX(LOCK_SH));
|
498
|
+
}
|
499
|
+
EOF
|
500
|
+
|
501
|
+
@parser = util_parser content
|
502
|
+
|
503
|
+
@parser.do_modules
|
504
|
+
@parser.do_classes
|
505
|
+
@parser.do_constants
|
506
|
+
|
507
|
+
klass = @parser.classes['rb_mFConst']
|
508
|
+
|
509
|
+
constants = klass.constants
|
510
|
+
refute_empty klass.constants
|
511
|
+
|
512
|
+
constant = constants.first
|
513
|
+
|
514
|
+
assert_equal 'LOCK_SH', constant.name
|
515
|
+
assert_equal 'INT2FIX(LOCK_SH)', constant.value
|
516
|
+
assert_equal 'Shared lock', constant.comment.text
|
517
|
+
end
|
518
|
+
|
472
519
|
def test_do_includes
|
473
520
|
content = <<-EOF
|
474
521
|
Init_foo() {
|
@@ -502,7 +549,7 @@ void Init_Blah(void) {
|
|
502
549
|
|
503
550
|
klass = nil
|
504
551
|
|
505
|
-
_, err =
|
552
|
+
_, err = verbose_capture_io do
|
506
553
|
klass = util_get_class content, 'cDate'
|
507
554
|
end
|
508
555
|
|
@@ -524,7 +571,7 @@ void Init_Blah(void) {
|
|
524
571
|
|
525
572
|
klass = nil
|
526
573
|
|
527
|
-
_, err =
|
574
|
+
_, err = verbose_capture_io do
|
528
575
|
klass = util_get_class content, 'cDate'
|
529
576
|
end
|
530
577
|
|
@@ -546,7 +593,7 @@ void Init_Blah(void) {
|
|
546
593
|
|
547
594
|
klass = nil
|
548
595
|
|
549
|
-
_, err =
|
596
|
+
_, err = verbose_capture_io do
|
550
597
|
klass = util_get_class content, 'cDate'
|
551
598
|
end
|
552
599
|
|
@@ -574,8 +621,59 @@ void Init_Blah(void) {
|
|
574
621
|
assert methods.first.singleton
|
575
622
|
end
|
576
623
|
|
624
|
+
def test_do_missing
|
625
|
+
parser = util_parser
|
626
|
+
|
627
|
+
klass_a = @top_level.add_class RDoc::ClassModule, 'A'
|
628
|
+
parser.classes['a'] = klass_a
|
629
|
+
|
630
|
+
parser.enclosure_dependencies['c'] << 'b'
|
631
|
+
parser.enclosure_dependencies['b'] << 'a'
|
632
|
+
parser.enclosure_dependencies['d'] << 'a'
|
633
|
+
|
634
|
+
parser.missing_dependencies['d'] = ['d', :class, 'D', 'Object', 'a']
|
635
|
+
parser.missing_dependencies['c'] = ['c', :class, 'C', 'Object', 'b']
|
636
|
+
parser.missing_dependencies['b'] = ['b', :class, 'B', 'Object', 'a']
|
637
|
+
|
638
|
+
parser.do_missing
|
639
|
+
|
640
|
+
assert_equal %w[A A::B A::B::C A::D],
|
641
|
+
@store.all_classes_and_modules.map { |m| m.full_name }.sort
|
642
|
+
end
|
643
|
+
|
644
|
+
def test_do_missing_cycle
|
645
|
+
parser = util_parser
|
646
|
+
|
647
|
+
klass_a = @top_level.add_class RDoc::ClassModule, 'A'
|
648
|
+
parser.classes['a'] = klass_a
|
649
|
+
|
650
|
+
parser.enclosure_dependencies['c'] << 'b'
|
651
|
+
parser.enclosure_dependencies['b'] << 'a'
|
652
|
+
|
653
|
+
parser.missing_dependencies['c'] = ['c', :class, 'C', 'Object', 'b']
|
654
|
+
parser.missing_dependencies['b'] = ['b', :class, 'B', 'Object', 'a']
|
655
|
+
|
656
|
+
parser.enclosure_dependencies['y'] << 'z'
|
657
|
+
parser.enclosure_dependencies['z'] << 'y'
|
658
|
+
|
659
|
+
parser.missing_dependencies['y'] = ['y', :class, 'Y', 'Object', 'z']
|
660
|
+
parser.missing_dependencies['z'] = ['z', :class, 'Z', 'Object', 'y']
|
661
|
+
|
662
|
+
_, err = verbose_capture_io do
|
663
|
+
parser.do_missing
|
664
|
+
end
|
665
|
+
|
666
|
+
expected = 'Unable to create class Y (y), class Z (z) ' +
|
667
|
+
'due to a cyclic class or module creation'
|
668
|
+
|
669
|
+
assert_equal expected, err.chomp
|
670
|
+
|
671
|
+
assert_equal %w[A A::B A::B::C],
|
672
|
+
@store.all_classes_and_modules.map { |m| m.full_name }.sort
|
673
|
+
end
|
674
|
+
|
577
675
|
def test_find_alias_comment
|
578
|
-
parser = util_parser
|
676
|
+
parser = util_parser
|
579
677
|
|
580
678
|
comment = parser.find_alias_comment 'C', '[]', 'index'
|
581
679
|
|
@@ -594,24 +692,25 @@ rb_define_alias(C, "[]", "index");
|
|
594
692
|
assert_equal "/*\n * comment\n */\n\n", comment.text
|
595
693
|
end
|
596
694
|
|
597
|
-
def
|
695
|
+
def test_find_class_comment
|
598
696
|
@options.rdoc_include << File.dirname(__FILE__)
|
599
697
|
|
600
698
|
content = <<-EOF
|
601
699
|
/*
|
602
|
-
*
|
603
|
-
*
|
604
|
-
* :include: test.txt
|
700
|
+
* Comment 1
|
605
701
|
*/
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
702
|
+
foo = rb_define_class("MyClassName1", rb_cObject);
|
703
|
+
|
704
|
+
/*
|
705
|
+
* Comment 2
|
706
|
+
*/
|
707
|
+
bar = rb_define_class("MyClassName2", rb_cObject);
|
610
708
|
EOF
|
611
709
|
|
612
|
-
|
710
|
+
util_get_class content
|
613
711
|
|
614
|
-
assert_equal "
|
712
|
+
assert_equal "Comment 1", @parser.classes['foo'].comment.text
|
713
|
+
assert_equal "Comment 2", @parser.classes['bar'].comment.text
|
615
714
|
end
|
616
715
|
|
617
716
|
def test_find_class_comment_init
|
@@ -1041,7 +1140,7 @@ If no arguments are given:
|
|
1041
1140
|
|
1042
1141
|
COMMENT
|
1043
1142
|
|
1044
|
-
parser = util_parser
|
1143
|
+
parser = util_parser
|
1045
1144
|
method_obj = RDoc::AnyMethod.new nil, 'blah'
|
1046
1145
|
|
1047
1146
|
parser.find_modifiers comment, method_obj
|
@@ -1063,7 +1162,7 @@ commercial() -> Date <br />
|
|
1063
1162
|
|
1064
1163
|
COMMENT
|
1065
1164
|
|
1066
|
-
parser = util_parser
|
1165
|
+
parser = util_parser
|
1067
1166
|
method_obj = RDoc::AnyMethod.new nil, 'blah'
|
1068
1167
|
|
1069
1168
|
parser.find_modifiers comment, method_obj
|
@@ -1080,7 +1179,7 @@ commercial() -> Date <br />
|
|
1080
1179
|
|
1081
1180
|
COMMENT
|
1082
1181
|
|
1083
|
-
parser = util_parser
|
1182
|
+
parser = util_parser
|
1084
1183
|
method_obj = RDoc::AnyMethod.new nil, 'blah'
|
1085
1184
|
|
1086
1185
|
parser.find_modifiers comment, method_obj
|
@@ -1208,7 +1307,7 @@ void Init_Blah(void) {
|
|
1208
1307
|
end
|
1209
1308
|
|
1210
1309
|
def test_look_for_directives_in
|
1211
|
-
parser = util_parser
|
1310
|
+
parser = util_parser
|
1212
1311
|
|
1213
1312
|
comment = RDoc::Comment.new "# :other: not_handled\n"
|
1214
1313
|
|
@@ -1366,7 +1465,7 @@ Init_IO(void) {
|
|
1366
1465
|
end
|
1367
1466
|
|
1368
1467
|
def test_rb_scan_args
|
1369
|
-
parser = util_parser
|
1468
|
+
parser = util_parser
|
1370
1469
|
|
1371
1470
|
assert_equal '(p1)',
|
1372
1471
|
parser.rb_scan_args('rb_scan_args(a, b, "1",)')
|
@@ -1424,13 +1523,39 @@ Init_IO(void) {
|
|
1424
1523
|
parser.rb_scan_args('rb_scan_args(a, b, "*:&",)')
|
1425
1524
|
end
|
1426
1525
|
|
1427
|
-
def
|
1526
|
+
def test_scan_order_dependent
|
1527
|
+
parser = util_parser <<-C
|
1528
|
+
void a(void) {
|
1529
|
+
mA = rb_define_module("A");
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
void b(void) {
|
1533
|
+
cB = rb_define_class_under(mA, "B", rb_cObject);
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
void c(void) {
|
1537
|
+
mC = rb_define_module_under(cB, "C");
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
void d(void) {
|
1541
|
+
mD = rb_define_class_under(mC, "D");
|
1542
|
+
}
|
1543
|
+
C
|
1544
|
+
|
1545
|
+
parser.scan
|
1546
|
+
|
1547
|
+
assert_equal %w[A A::B A::B::C],
|
1548
|
+
@store.all_classes_and_modules.map { |m| m.full_name }.sort
|
1549
|
+
end
|
1550
|
+
|
1551
|
+
def util_get_class content, name = nil
|
1428
1552
|
@parser = util_parser content
|
1429
1553
|
@parser.scan
|
1430
|
-
|
1554
|
+
|
1555
|
+
@parser.classes[name] if name
|
1431
1556
|
end
|
1432
1557
|
|
1433
|
-
def util_parser
|
1558
|
+
def util_parser content = ''
|
1434
1559
|
RDoc::Parser::C.new @top_level, @fn, content, @options, @stats
|
1435
1560
|
end
|
1436
1561
|
|