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
@@ -8,10 +8,10 @@ class TestRDocParserSimple < RDoc::TestCase
|
|
8
8
|
@tempfile = Tempfile.new self.class.name
|
9
9
|
filename = @tempfile.path
|
10
10
|
|
11
|
-
@top_level =
|
11
|
+
@top_level = @store.add_file filename
|
12
12
|
@fn = filename
|
13
13
|
@options = RDoc::Options.new
|
14
|
-
@stats = RDoc::Stats.new 0
|
14
|
+
@stats = RDoc::Stats.new @store, 0
|
15
15
|
end
|
16
16
|
|
17
17
|
def teardown
|
data/test/test_rdoc_rdoc.rb
CHANGED
@@ -8,38 +8,39 @@ class TestRDocRDoc < RDoc::TestCase
|
|
8
8
|
@rdoc = RDoc::RDoc.new
|
9
9
|
@rdoc.options = RDoc::Options.new
|
10
10
|
|
11
|
-
@stats = RDoc::Stats.new 0, 0
|
11
|
+
@stats = RDoc::Stats.new @store, 0, 0
|
12
12
|
@rdoc.instance_variable_set :@stats, @stats
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
RDoc::
|
15
|
+
def test_document # functional test
|
16
|
+
options = RDoc::Options.new
|
17
|
+
options.files = [File.expand_path('../xref_data.rb')]
|
18
|
+
options.setup_generator 'ri'
|
19
|
+
options.main_page = 'MAIN_PAGE.rdoc'
|
20
|
+
options.title = 'title'
|
17
21
|
|
18
|
-
|
19
|
-
tl.add_class RDoc::NormalClass, 'C'
|
20
|
-
tl.add_class RDoc::NormalModule, 'M'
|
22
|
+
rdoc = RDoc::RDoc.new
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
known_bodies['A'] = 'B'
|
27
|
-
|
28
|
-
RDoc::RDoc.reset
|
24
|
+
temp_dir do
|
25
|
+
capture_io do
|
26
|
+
rdoc.document options
|
27
|
+
end
|
29
28
|
|
30
|
-
|
29
|
+
assert File.directory? 'doc'
|
30
|
+
assert_equal rdoc, rdoc.store.rdoc
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
assert_empty RDoc::TopLevel.all_files_hash
|
34
|
-
assert_empty RDoc::TopLevel.all_modules_hash
|
33
|
+
store = rdoc.store
|
35
34
|
|
36
|
-
|
37
|
-
|
35
|
+
assert_equal 'MAIN_PAGE.rdoc', store.main
|
36
|
+
assert_equal 'title', store.title
|
38
37
|
end
|
39
38
|
|
40
39
|
def test_gather_files
|
41
|
-
|
42
|
-
|
40
|
+
a = File.expand_path __FILE__
|
41
|
+
b = File.expand_path '../test_rdoc_text.rb', __FILE__
|
42
|
+
|
43
|
+
assert_equal [a, b], @rdoc.gather_files([b, a, b])
|
43
44
|
end
|
44
45
|
|
45
46
|
def test_handle_pipe
|
@@ -121,9 +122,69 @@ class TestRDocRDoc < RDoc::TestCase
|
|
121
122
|
assert_empty files
|
122
123
|
end
|
123
124
|
|
125
|
+
def test_normalized_file_list_non_file_directory
|
126
|
+
skip '/dev/stdin is not a character special' unless
|
127
|
+
File.chardev? '/dev/stdin'
|
128
|
+
|
129
|
+
files = nil
|
130
|
+
|
131
|
+
out, err = verbose_capture_io do
|
132
|
+
files = @rdoc.normalized_file_list %w[/dev/stdin]
|
133
|
+
end
|
134
|
+
|
135
|
+
files = files.map { |file| File.expand_path file }
|
136
|
+
|
137
|
+
assert_empty files
|
138
|
+
|
139
|
+
assert_empty out
|
140
|
+
assert_match %r%^rdoc can't parse%, err
|
141
|
+
assert_match %r%/dev/stdin$%, err
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_parse_file
|
145
|
+
@rdoc.store = RDoc::Store.new
|
146
|
+
|
147
|
+
temp_dir do |dir|
|
148
|
+
@rdoc.options.root = Pathname(Dir.pwd)
|
149
|
+
|
150
|
+
open 'test.txt', 'w' do |io|
|
151
|
+
io.puts 'hi'
|
152
|
+
end
|
153
|
+
|
154
|
+
top_level = @rdoc.parse_file 'test.txt'
|
155
|
+
|
156
|
+
assert_equal 'test.txt', top_level.absolute_name
|
157
|
+
assert_equal 'test.txt', top_level.relative_name
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_parse_file_relative
|
162
|
+
pwd = Dir.pwd
|
163
|
+
|
164
|
+
@rdoc.store = RDoc::Store.new
|
165
|
+
|
166
|
+
temp_dir do |dir|
|
167
|
+
@rdoc.options.root = Pathname(dir)
|
168
|
+
|
169
|
+
open 'test.txt', 'w' do |io|
|
170
|
+
io.puts 'hi'
|
171
|
+
end
|
172
|
+
|
173
|
+
test_txt = File.join dir, 'test.txt'
|
174
|
+
|
175
|
+
Dir.chdir pwd do
|
176
|
+
top_level = @rdoc.parse_file test_txt
|
177
|
+
|
178
|
+
assert_equal test_txt, top_level.absolute_name
|
179
|
+
assert_equal 'test.txt', top_level.relative_name
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
124
184
|
def test_parse_file_encoding
|
125
185
|
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
126
186
|
@rdoc.options.encoding = Encoding::ISO_8859_1
|
187
|
+
@rdoc.store = RDoc::Store.new
|
127
188
|
|
128
189
|
Tempfile.open 'test.txt' do |io|
|
129
190
|
io.write 'hi'
|
@@ -135,6 +196,33 @@ class TestRDocRDoc < RDoc::TestCase
|
|
135
196
|
end
|
136
197
|
end
|
137
198
|
|
199
|
+
def test_parse_file_forbidden
|
200
|
+
skip 'chmod not supported' if Gem.win_platform?
|
201
|
+
|
202
|
+
@rdoc.store = RDoc::Store.new
|
203
|
+
|
204
|
+
Tempfile.open 'test.txt' do |io|
|
205
|
+
io.write 'hi'
|
206
|
+
io.rewind
|
207
|
+
|
208
|
+
File.chmod 0000, io.path
|
209
|
+
|
210
|
+
begin
|
211
|
+
top_level = :bug
|
212
|
+
|
213
|
+
_, err = capture_io do
|
214
|
+
top_level = @rdoc.parse_file io.path
|
215
|
+
end
|
216
|
+
|
217
|
+
assert_match "Unable to read #{io.path},", err
|
218
|
+
|
219
|
+
assert_nil top_level
|
220
|
+
ensure
|
221
|
+
File.chmod 0400, io.path
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
138
226
|
def test_remove_unparseable
|
139
227
|
file_list = %w[
|
140
228
|
blah.class
|
@@ -150,7 +238,7 @@ class TestRDocRDoc < RDoc::TestCase
|
|
150
238
|
|
151
239
|
def test_remove_unparseable_tags_emacs
|
152
240
|
temp_dir do
|
153
|
-
open 'TAGS', '
|
241
|
+
open 'TAGS', 'wb' do |io| # emacs
|
154
242
|
io.write "\f\nlib/foo.rb,43\n"
|
155
243
|
end
|
156
244
|
|
data/test/test_rdoc_ri_driver.rb
CHANGED
@@ -16,10 +16,16 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
16
16
|
ENV['HOME'] = @tmpdir
|
17
17
|
ENV.delete 'RI'
|
18
18
|
|
19
|
-
@options = RDoc::RI::Driver.
|
20
|
-
@options[:
|
19
|
+
@options = RDoc::RI::Driver.default_options
|
20
|
+
@options[:use_system] = false
|
21
|
+
@options[:use_site] = false
|
22
|
+
@options[:use_home] = false
|
23
|
+
@options[:use_gems] = false
|
24
|
+
|
25
|
+
@options[:home] = @tmpdir
|
21
26
|
@options[:use_stdout] = true
|
22
|
-
@options[:formatter]
|
27
|
+
@options[:formatter] = @RM::ToRdoc
|
28
|
+
|
23
29
|
@driver = RDoc::RI::Driver.new @options
|
24
30
|
end
|
25
31
|
|
@@ -51,7 +57,7 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
51
57
|
util_store
|
52
58
|
|
53
59
|
out, = capture_io do
|
54
|
-
RDoc::RI::Driver.dump @
|
60
|
+
RDoc::RI::Driver.dump @store1.cache_path
|
55
61
|
end
|
56
62
|
|
57
63
|
assert_match %r%:class_methods%, out
|
@@ -81,7 +87,7 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
81
87
|
@RM::Rule.new(1),
|
82
88
|
@RM::Paragraph.new('Also found in:'),
|
83
89
|
@RM::Verbatim.new("ruby core", "\n",
|
84
|
-
"~/.
|
90
|
+
"~/.rdoc", "\n"))
|
85
91
|
|
86
92
|
assert_equal expected, out
|
87
93
|
end
|
@@ -102,26 +108,44 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
102
108
|
|
103
109
|
def test_add_from
|
104
110
|
util_store
|
105
|
-
@
|
111
|
+
@store1.type = :system
|
106
112
|
|
107
113
|
out = @RM::Document.new
|
108
114
|
|
109
|
-
@driver.add_from out, @
|
115
|
+
@driver.add_from out, @store1
|
110
116
|
|
111
117
|
expected = @RM::Document.new @RM::Paragraph.new("(from ruby core)")
|
112
118
|
|
113
119
|
assert_equal expected, out
|
114
120
|
end
|
115
121
|
|
116
|
-
def
|
122
|
+
def test_add_extends
|
123
|
+
util_store
|
124
|
+
|
117
125
|
out = @RM::Document.new
|
118
126
|
|
119
|
-
@driver.
|
127
|
+
@driver.add_extends out, [[[@cFooExt], @store1]]
|
128
|
+
|
129
|
+
expected = @RM::Document.new(
|
130
|
+
@RM::Rule.new(1),
|
131
|
+
@RM::Heading.new(1, "Extended by:"),
|
132
|
+
@RM::Paragraph.new("Ext (from #{@store1.friendly_path})"),
|
133
|
+
@RM::BlankLine.new,
|
134
|
+
@RM::Paragraph.new("Extend thingy"),
|
135
|
+
@RM::BlankLine.new)
|
136
|
+
|
137
|
+
assert_equal expected, out
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_add_extension_modules_empty
|
141
|
+
out = @RM::Document.new
|
142
|
+
|
143
|
+
@driver.add_extension_modules out, 'Includes', []
|
120
144
|
|
121
145
|
assert_empty out
|
122
146
|
end
|
123
147
|
|
124
|
-
def
|
148
|
+
def test_add_extension_modules_many
|
125
149
|
util_store
|
126
150
|
|
127
151
|
out = @RM::Document.new
|
@@ -129,12 +153,12 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
129
153
|
enum = RDoc::Include.new 'Enumerable', nil
|
130
154
|
@cFoo.add_include enum
|
131
155
|
|
132
|
-
@driver.
|
156
|
+
@driver.add_extension_modules out, 'Includes', [[[@cFooInc, enum], @store1]]
|
133
157
|
|
134
158
|
expected = @RM::Document.new(
|
135
159
|
@RM::Rule.new(1),
|
136
160
|
@RM::Heading.new(1, "Includes:"),
|
137
|
-
@RM::Paragraph.new("(from #{@
|
161
|
+
@RM::Paragraph.new("(from #{@store1.friendly_path})"),
|
138
162
|
@RM::BlankLine.new,
|
139
163
|
@RM::Paragraph.new("Inc"),
|
140
164
|
@RM::BlankLine.new,
|
@@ -145,7 +169,7 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
145
169
|
assert_equal expected, out
|
146
170
|
end
|
147
171
|
|
148
|
-
def
|
172
|
+
def test_add_extension_modules_many_no_doc
|
149
173
|
util_store
|
150
174
|
|
151
175
|
out = @RM::Document.new
|
@@ -154,29 +178,29 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
154
178
|
@cFoo.add_include enum
|
155
179
|
@cFooInc.instance_variable_set :@comment, ''
|
156
180
|
|
157
|
-
@driver.
|
181
|
+
@driver.add_extension_modules out, 'Includes', [[[@cFooInc, enum], @store1]]
|
158
182
|
|
159
183
|
expected = @RM::Document.new(
|
160
184
|
@RM::Rule.new(1),
|
161
185
|
@RM::Heading.new(1, "Includes:"),
|
162
|
-
@RM::Paragraph.new("(from #{@
|
186
|
+
@RM::Paragraph.new("(from #{@store1.friendly_path})"),
|
163
187
|
@RM::Verbatim.new("Inc", "\n",
|
164
188
|
"Enumerable", "\n"))
|
165
189
|
|
166
190
|
assert_equal expected, out
|
167
191
|
end
|
168
192
|
|
169
|
-
def
|
193
|
+
def test_add_extension_modules_one
|
170
194
|
util_store
|
171
195
|
|
172
196
|
out = @RM::Document.new
|
173
197
|
|
174
|
-
@driver.
|
198
|
+
@driver.add_extension_modules out, 'Includes', [[[@cFooInc], @store1]]
|
175
199
|
|
176
200
|
expected = @RM::Document.new(
|
177
201
|
@RM::Rule.new(1),
|
178
202
|
@RM::Heading.new(1, "Includes:"),
|
179
|
-
@RM::Paragraph.new("Inc (from #{@
|
203
|
+
@RM::Paragraph.new("Inc (from #{@store1.friendly_path})"),
|
180
204
|
@RM::BlankLine.new,
|
181
205
|
@RM::Paragraph.new("Include thingy"),
|
182
206
|
@RM::BlankLine.new)
|
@@ -184,6 +208,137 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
184
208
|
assert_equal expected, out
|
185
209
|
end
|
186
210
|
|
211
|
+
def test_add_includes
|
212
|
+
util_store
|
213
|
+
|
214
|
+
out = @RM::Document.new
|
215
|
+
|
216
|
+
@driver.add_includes out, [[[@cFooInc], @store1]]
|
217
|
+
|
218
|
+
expected = @RM::Document.new(
|
219
|
+
@RM::Rule.new(1),
|
220
|
+
@RM::Heading.new(1, "Includes:"),
|
221
|
+
@RM::Paragraph.new("Inc (from #{@store1.friendly_path})"),
|
222
|
+
@RM::BlankLine.new,
|
223
|
+
@RM::Paragraph.new("Include thingy"),
|
224
|
+
@RM::BlankLine.new)
|
225
|
+
|
226
|
+
assert_equal expected, out
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_add_method
|
230
|
+
util_store
|
231
|
+
|
232
|
+
out = doc
|
233
|
+
|
234
|
+
@driver.add_method out, 'Foo::Bar#blah'
|
235
|
+
|
236
|
+
expected =
|
237
|
+
doc(
|
238
|
+
head(1, 'Foo::Bar#blah'),
|
239
|
+
blank_line,
|
240
|
+
para('(from ~/.rdoc)'),
|
241
|
+
head(3, 'Implementation from Bar'),
|
242
|
+
rule(1),
|
243
|
+
verb("blah(5) => 5\n",
|
244
|
+
"blah(6) => 6\n"),
|
245
|
+
rule(1),
|
246
|
+
blank_line,
|
247
|
+
blank_line)
|
248
|
+
|
249
|
+
assert_equal expected, out
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_add_method_attribute
|
253
|
+
util_store
|
254
|
+
|
255
|
+
out = doc
|
256
|
+
|
257
|
+
@driver.add_method out, 'Foo::Bar#attr'
|
258
|
+
|
259
|
+
expected =
|
260
|
+
doc(
|
261
|
+
head(1, 'Foo::Bar#attr'),
|
262
|
+
blank_line,
|
263
|
+
para('(from ~/.rdoc)'),
|
264
|
+
rule(1),
|
265
|
+
blank_line,
|
266
|
+
blank_line)
|
267
|
+
|
268
|
+
assert_equal expected, out
|
269
|
+
end
|
270
|
+
|
271
|
+
def test_add_method_inherited
|
272
|
+
util_multi_store
|
273
|
+
|
274
|
+
out = doc
|
275
|
+
|
276
|
+
@driver.add_method out, 'Bar#inherit'
|
277
|
+
|
278
|
+
expected =
|
279
|
+
doc(
|
280
|
+
head(1, 'Bar#inherit'),
|
281
|
+
blank_line,
|
282
|
+
para('(from ~/.rdoc)'),
|
283
|
+
head(3, 'Implementation from Foo'),
|
284
|
+
rule(1),
|
285
|
+
blank_line,
|
286
|
+
blank_line)
|
287
|
+
|
288
|
+
assert_equal expected, out
|
289
|
+
end
|
290
|
+
|
291
|
+
def test_add_method_overriden
|
292
|
+
util_multi_store
|
293
|
+
|
294
|
+
out = doc
|
295
|
+
|
296
|
+
@driver.add_method out, 'Bar#override'
|
297
|
+
|
298
|
+
expected =
|
299
|
+
doc(
|
300
|
+
head(1, 'Bar#override'),
|
301
|
+
blank_line,
|
302
|
+
para("(from #{@store2.path})"),
|
303
|
+
rule(1),
|
304
|
+
blank_line,
|
305
|
+
para('must be displayed'),
|
306
|
+
blank_line,
|
307
|
+
blank_line)
|
308
|
+
|
309
|
+
assert_equal expected, out
|
310
|
+
end
|
311
|
+
|
312
|
+
def test_add_method_documentation
|
313
|
+
util_store
|
314
|
+
|
315
|
+
out = doc()
|
316
|
+
|
317
|
+
missing = RDoc::AnyMethod.new nil, 'missing'
|
318
|
+
@cFoo.add_method missing
|
319
|
+
|
320
|
+
@driver.add_method_documentation out, @cFoo
|
321
|
+
|
322
|
+
expected =
|
323
|
+
doc(
|
324
|
+
head(1, 'Foo#inherit'),
|
325
|
+
blank_line,
|
326
|
+
para('(from ~/.rdoc)'),
|
327
|
+
rule(1),
|
328
|
+
blank_line,
|
329
|
+
blank_line,
|
330
|
+
head(1, 'Foo#override'),
|
331
|
+
blank_line,
|
332
|
+
para('(from ~/.rdoc)'),
|
333
|
+
rule(1),
|
334
|
+
blank_line,
|
335
|
+
para('must not be displayed in Bar#override'),
|
336
|
+
blank_line,
|
337
|
+
blank_line)
|
338
|
+
|
339
|
+
assert_equal expected, out
|
340
|
+
end
|
341
|
+
|
187
342
|
def test_add_method_list
|
188
343
|
out = @RM::Document.new
|
189
344
|
|
@@ -236,35 +391,48 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
236
391
|
expected = {
|
237
392
|
'Ambiguous' => [@store1, @store2],
|
238
393
|
'Bar' => [@store2],
|
239
|
-
'
|
394
|
+
'Ext' => [@store1],
|
395
|
+
'Foo' => [@store1, @store2],
|
240
396
|
'Foo::Bar' => [@store1],
|
241
397
|
'Foo::Baz' => [@store1, @store2],
|
242
398
|
'Inc' => [@store1],
|
243
399
|
}
|
244
400
|
|
245
|
-
|
401
|
+
classes = @driver.classes
|
402
|
+
|
403
|
+
assert_equal expected.keys.sort, classes.keys.sort
|
404
|
+
|
405
|
+
expected.each do |klass, stores|
|
406
|
+
assert_equal stores, classes[klass].sort_by { |store| store.path },
|
407
|
+
"mismatch for #{klass}"
|
408
|
+
end
|
246
409
|
end
|
247
410
|
|
248
411
|
def test_class_document
|
249
412
|
util_store
|
250
413
|
|
251
|
-
tl1 =
|
252
|
-
tl2 =
|
414
|
+
tl1 = @store1.add_file 'one.rb'
|
415
|
+
tl2 = @store1.add_file 'two.rb'
|
253
416
|
|
254
417
|
@cFoo.add_comment 'one', tl1
|
255
418
|
@cFoo.add_comment 'two', tl2
|
256
|
-
|
419
|
+
|
420
|
+
@store1.save_class @cFoo
|
257
421
|
|
258
422
|
found = [
|
259
|
-
[@
|
423
|
+
[@store1, @store1.load_class(@cFoo.full_name)]
|
260
424
|
]
|
261
425
|
|
262
|
-
|
426
|
+
extends = [[[@cFooExt], @store1]]
|
427
|
+
includes = [[[@cFooInc], @store1]]
|
428
|
+
|
429
|
+
out = @driver.class_document @cFoo.full_name, found, [], includes, extends
|
263
430
|
|
264
431
|
expected = @RM::Document.new
|
265
432
|
@driver.add_class expected, 'Foo', []
|
266
|
-
@driver.add_includes expected,
|
267
|
-
@driver.
|
433
|
+
@driver.add_includes expected, includes
|
434
|
+
@driver.add_extends expected, extends
|
435
|
+
@driver.add_from expected, @store1
|
268
436
|
expected << @RM::Rule.new(1)
|
269
437
|
|
270
438
|
doc = @RM::Document.new(@RM::Paragraph.new('one'))
|
@@ -370,6 +538,32 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
370
538
|
assert_match %r%^ attr_accessor attr%, out
|
371
539
|
|
372
540
|
assert_equal 1, out.scan(/-\n/).length
|
541
|
+
|
542
|
+
refute_match %r%Foo::Bar#blah%, out
|
543
|
+
end
|
544
|
+
|
545
|
+
def test_display_class_all
|
546
|
+
util_store
|
547
|
+
|
548
|
+
@driver.show_all = true
|
549
|
+
|
550
|
+
out, = capture_io do
|
551
|
+
@driver.display_class 'Foo::Bar'
|
552
|
+
end
|
553
|
+
|
554
|
+
assert_match %r%^= Foo::Bar%, out
|
555
|
+
assert_match %r%^\(from%, out
|
556
|
+
|
557
|
+
assert_match %r%^= Class methods:%, out
|
558
|
+
assert_match %r%^ new%, out
|
559
|
+
assert_match %r%^= Instance methods:%, out
|
560
|
+
assert_match %r%^ blah%, out
|
561
|
+
assert_match %r%^= Attributes:%, out
|
562
|
+
assert_match %r%^ attr_accessor attr%, out
|
563
|
+
|
564
|
+
assert_equal 6, out.scan(/-\n/).length
|
565
|
+
|
566
|
+
assert_match %r%Foo::Bar#blah%, out
|
373
567
|
end
|
374
568
|
|
375
569
|
def test_display_class_ambiguous
|
@@ -416,6 +610,14 @@ class TestRDocRIDriver < RDoc::TestCase
|
|
416
610
|
assert_match %r%^= Inc$%, out
|
417
611
|
end
|
418
612
|
|
613
|
+
def test_display_class_page
|
614
|
+
out, = capture_io do
|
615
|
+
@driver.display_class 'ruby:README'
|
616
|
+
end
|
617
|
+
|
618
|
+
assert_empty out
|
619
|
+
end
|
620
|
+
|
419
621
|
def test_display_method
|
420
622
|
util_store
|
421
623
|
|
@@ -504,6 +706,102 @@ Foo::Bar#bother
|
|
504
706
|
assert_match %r%things.*stuff%, out
|
505
707
|
end
|
506
708
|
|
709
|
+
def test_display_page
|
710
|
+
util_store
|
711
|
+
|
712
|
+
out, = capture_io do
|
713
|
+
@driver.display_page 'home:README.rdoc'
|
714
|
+
end
|
715
|
+
|
716
|
+
assert_match %r%= README%, out
|
717
|
+
end
|
718
|
+
|
719
|
+
def test_display_page_add_extension
|
720
|
+
util_store
|
721
|
+
|
722
|
+
out, = capture_io do
|
723
|
+
@driver.display_page 'home:README'
|
724
|
+
end
|
725
|
+
|
726
|
+
assert_match %r%= README%, out
|
727
|
+
end
|
728
|
+
|
729
|
+
def test_display_page_ambiguous
|
730
|
+
util_store
|
731
|
+
|
732
|
+
other = @store1.add_file 'README.md'
|
733
|
+
other.parser = RDoc::Parser::Simple
|
734
|
+
other.comment =
|
735
|
+
doc(
|
736
|
+
head(1, 'README.md'),
|
737
|
+
para('This is the other README'))
|
738
|
+
|
739
|
+
@store1.save_page other
|
740
|
+
|
741
|
+
out, = capture_io do
|
742
|
+
@driver.display_page 'home:README'
|
743
|
+
end
|
744
|
+
|
745
|
+
assert_match %r%= README pages in ~/\.rdoc%, out
|
746
|
+
assert_match %r%README\.rdoc%, out
|
747
|
+
assert_match %r%README\.md%, out
|
748
|
+
end
|
749
|
+
|
750
|
+
def test_display_page_ignore_directory
|
751
|
+
util_store
|
752
|
+
|
753
|
+
other = @store1.add_file 'doc/globals.rdoc'
|
754
|
+
other.parser = RDoc::Parser::Simple
|
755
|
+
other.comment =
|
756
|
+
doc(
|
757
|
+
head(1, 'globals.rdoc'),
|
758
|
+
para('Globals go here'))
|
759
|
+
|
760
|
+
@store1.save_page other
|
761
|
+
|
762
|
+
out, = capture_io do
|
763
|
+
@driver.display_page 'home:globals'
|
764
|
+
end
|
765
|
+
|
766
|
+
assert_match %r%= globals\.rdoc%, out
|
767
|
+
end
|
768
|
+
|
769
|
+
def test_display_page_missing
|
770
|
+
util_store
|
771
|
+
|
772
|
+
out, = capture_io do
|
773
|
+
@driver.display_page 'home:missing'
|
774
|
+
end
|
775
|
+
|
776
|
+
out, = capture_io do
|
777
|
+
@driver.display_page_list @store1
|
778
|
+
end
|
779
|
+
|
780
|
+
assert_match %r%= Pages in ~/\.rdoc%, out
|
781
|
+
assert_match %r%README\.rdoc%, out
|
782
|
+
end
|
783
|
+
|
784
|
+
def test_display_page_list
|
785
|
+
util_store
|
786
|
+
|
787
|
+
other = @store1.add_file 'OTHER.rdoc'
|
788
|
+
other.parser = RDoc::Parser::Simple
|
789
|
+
other.comment =
|
790
|
+
doc(
|
791
|
+
head(1, 'OTHER'),
|
792
|
+
para('This is OTHER'))
|
793
|
+
|
794
|
+
@store1.save_page other
|
795
|
+
|
796
|
+
out, = capture_io do
|
797
|
+
@driver.display_page_list @store1
|
798
|
+
end
|
799
|
+
|
800
|
+
assert_match %r%= Pages in ~/\.rdoc%, out
|
801
|
+
assert_match %r%README\.rdoc%, out
|
802
|
+
assert_match %r%OTHER\.rdoc%, out
|
803
|
+
end
|
804
|
+
|
507
805
|
def test_expand_class
|
508
806
|
util_store
|
509
807
|
|
@@ -527,6 +825,17 @@ Foo::Bar#bother
|
|
527
825
|
end
|
528
826
|
|
529
827
|
assert_equal 'Z', e.name
|
828
|
+
|
829
|
+
@driver.stores << RDoc::Store.new(nil, :system)
|
830
|
+
|
831
|
+
assert_equal 'ruby:README', @driver.expand_name('ruby:README')
|
832
|
+
assert_equal 'ruby:', @driver.expand_name('ruby:')
|
833
|
+
|
834
|
+
e = assert_raises RDoc::RI::Driver::NotFoundError do
|
835
|
+
@driver.expand_name 'nonexistent_gem:'
|
836
|
+
end
|
837
|
+
|
838
|
+
assert_equal 'nonexistent_gem', e.name
|
530
839
|
end
|
531
840
|
|
532
841
|
def test_find_methods
|
@@ -539,7 +848,7 @@ Foo::Bar#bother
|
|
539
848
|
end
|
540
849
|
|
541
850
|
expected = [
|
542
|
-
[@
|
851
|
+
[@store1, 'Foo::Bar', 'Foo::Bar', :both, nil],
|
543
852
|
]
|
544
853
|
|
545
854
|
assert_equal expected, items
|
@@ -555,11 +864,12 @@ Foo::Bar#bother
|
|
555
864
|
end
|
556
865
|
|
557
866
|
expected = [
|
558
|
-
[@
|
559
|
-
[@
|
560
|
-
[@
|
561
|
-
[@
|
562
|
-
[@
|
867
|
+
[@store1, 'Ambiguous', 'Ambiguous', :both, 'blah'],
|
868
|
+
[@store1, 'Ext', 'Ext', :both, 'blah'],
|
869
|
+
[@store1, 'Foo', 'Foo', :both, 'blah'],
|
870
|
+
[@store1, 'Foo::Bar', 'Foo::Bar', :both, 'blah'],
|
871
|
+
[@store1, 'Foo::Baz', 'Foo::Baz', :both, 'blah'],
|
872
|
+
[@store1, 'Inc', 'Inc', :both, 'blah'],
|
563
873
|
]
|
564
874
|
|
565
875
|
assert_equal expected, items
|
@@ -591,6 +901,21 @@ Foo::Bar#bother
|
|
591
901
|
assert_equal found, sorted
|
592
902
|
end
|
593
903
|
|
904
|
+
def test_find_store
|
905
|
+
@driver.stores << RDoc::Store.new(nil, :system)
|
906
|
+
@driver.stores << RDoc::Store.new('doc/gem-1.0/ri', :gem)
|
907
|
+
|
908
|
+
assert_equal 'ruby', @driver.find_store('ruby')
|
909
|
+
assert_equal 'gem-1.0', @driver.find_store('gem-1.0')
|
910
|
+
assert_equal 'gem-1.0', @driver.find_store('gem')
|
911
|
+
|
912
|
+
e = assert_raises RDoc::RI::Driver::NotFoundError do
|
913
|
+
@driver.find_store 'nonexistent'
|
914
|
+
end
|
915
|
+
|
916
|
+
assert_equal 'nonexistent', e.name
|
917
|
+
end
|
918
|
+
|
594
919
|
def test_formatter
|
595
920
|
tty = Object.new
|
596
921
|
def tty.tty?() true; end
|
@@ -604,20 +929,18 @@ Foo::Bar#bother
|
|
604
929
|
driver.instance_variable_set :@paging, true
|
605
930
|
|
606
931
|
assert_instance_of @RM::ToBs, driver.formatter(StringIO.new)
|
607
|
-
|
608
|
-
driver.instance_variable_set :@formatter_klass, @RM::ToHtml
|
609
|
-
|
610
|
-
assert_instance_of @RM::ToHtml, driver.formatter(tty)
|
611
932
|
end
|
612
933
|
|
613
934
|
def test_in_path_eh
|
614
935
|
path = ENV['PATH']
|
615
936
|
|
937
|
+
test_path = File.expand_path '..', __FILE__
|
938
|
+
|
616
939
|
temp_dir do |dir|
|
617
940
|
nonexistent = File.join dir, 'nonexistent'
|
618
941
|
refute @driver.in_path?(nonexistent)
|
619
942
|
|
620
|
-
ENV['PATH'] =
|
943
|
+
ENV['PATH'] = test_path
|
621
944
|
|
622
945
|
assert @driver.in_path?(File.basename(__FILE__))
|
623
946
|
end
|
@@ -656,7 +979,7 @@ Foo::Bar#bother
|
|
656
979
|
@driver.list_known_classes
|
657
980
|
end
|
658
981
|
|
659
|
-
assert_equal "Ambiguous\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
|
982
|
+
assert_equal "Ambiguous\nExt\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
|
660
983
|
end
|
661
984
|
|
662
985
|
def test_list_known_classes_name
|
@@ -698,15 +1021,15 @@ Foo::Bar#bother
|
|
698
1021
|
index = RDoc::AnyMethod.new nil, '[]'
|
699
1022
|
index.record_location @top_level
|
700
1023
|
@cFoo.add_method index
|
701
|
-
@
|
1024
|
+
@store1.save_method @cFoo, index
|
702
1025
|
|
703
1026
|
c_index = RDoc::AnyMethod.new nil, '[]'
|
704
1027
|
c_index.singleton = true
|
705
1028
|
c_index.record_location @top_level
|
706
1029
|
@cFoo.add_method c_index
|
707
|
-
@
|
1030
|
+
@store1.save_method @cFoo, c_index
|
708
1031
|
|
709
|
-
@
|
1032
|
+
@store1.save_cache
|
710
1033
|
|
711
1034
|
assert_equal %w[Foo#[]], @driver.list_methods_matching('Foo#[]')
|
712
1035
|
assert_equal %w[Foo::[]], @driver.list_methods_matching('Foo::[]')
|
@@ -715,7 +1038,7 @@ Foo::Bar#bother
|
|
715
1038
|
def test_load_method
|
716
1039
|
util_store
|
717
1040
|
|
718
|
-
method = @driver.load_method(@
|
1041
|
+
method = @driver.load_method(@store1, :instance_methods, 'Foo', '#',
|
719
1042
|
'inherit')
|
720
1043
|
|
721
1044
|
assert_equal @inherit, method
|
@@ -733,11 +1056,11 @@ Foo::Bar#bother
|
|
733
1056
|
def test_load_methods_matching
|
734
1057
|
util_store
|
735
1058
|
|
736
|
-
expected = [[@
|
1059
|
+
expected = [[@store1, [@inherit]]]
|
737
1060
|
|
738
1061
|
assert_equal expected, @driver.load_methods_matching('Foo#inherit')
|
739
1062
|
|
740
|
-
expected = [[@
|
1063
|
+
expected = [[@store1, [@blah]]]
|
741
1064
|
|
742
1065
|
assert_equal expected, @driver.load_methods_matching('.blah')
|
743
1066
|
|
@@ -766,6 +1089,20 @@ Foo::Bar#bother
|
|
766
1089
|
refute @driver.paging?
|
767
1090
|
end
|
768
1091
|
|
1092
|
+
# this test is too fragile. Perhaps using Process.spawn will make this
|
1093
|
+
# reliable
|
1094
|
+
def _test_page_in_presence_of_child_status
|
1095
|
+
skip 'this test hangs on travis-ci.org' if ENV['CI']
|
1096
|
+
@driver.use_stdout = false
|
1097
|
+
|
1098
|
+
with_dummy_pager do
|
1099
|
+
@driver.page do |io|
|
1100
|
+
refute_equal $stdout, io
|
1101
|
+
assert @driver.paging?
|
1102
|
+
end
|
1103
|
+
end
|
1104
|
+
end
|
1105
|
+
|
769
1106
|
def test_page_stdout
|
770
1107
|
@driver.use_stdout = true
|
771
1108
|
|
@@ -796,6 +1133,20 @@ Foo::Bar#bother
|
|
796
1133
|
assert_equal 'foo', meth, '::foo method'
|
797
1134
|
end
|
798
1135
|
|
1136
|
+
def test_parse_name_page
|
1137
|
+
klass, type, meth = @driver.parse_name 'ruby:README'
|
1138
|
+
|
1139
|
+
assert_equal 'ruby', klass, 'ruby project'
|
1140
|
+
assert_equal ':', type, 'ruby type'
|
1141
|
+
assert_equal 'README', meth, 'ruby page'
|
1142
|
+
|
1143
|
+
klass, type, meth = @driver.parse_name 'ruby:'
|
1144
|
+
|
1145
|
+
assert_equal 'ruby', klass, 'ruby project'
|
1146
|
+
assert_equal ':', type, 'ruby type'
|
1147
|
+
assert_equal nil, meth, 'ruby page'
|
1148
|
+
end
|
1149
|
+
|
799
1150
|
def test_parse_name_single_class
|
800
1151
|
klass, type, meth = @driver.parse_name 'Foo'
|
801
1152
|
|
@@ -956,13 +1307,11 @@ Foo::Bar#bother
|
|
956
1307
|
def util_multi_store
|
957
1308
|
util_store
|
958
1309
|
|
959
|
-
@store1 = @store
|
960
|
-
|
961
|
-
@top_level = RDoc::TopLevel.new 'file.rb'
|
962
|
-
|
963
1310
|
@home_ri2 = "#{@home_ri}2"
|
964
1311
|
@store2 = RDoc::RI::Store.new @home_ri2
|
965
1312
|
|
1313
|
+
@top_level = @store2.add_file 'file.rb'
|
1314
|
+
|
966
1315
|
# as if seen in a namespace like class Ambiguous::Other
|
967
1316
|
@mAmbiguous = @top_level.add_module RDoc::NormalModule, 'Ambiguous'
|
968
1317
|
|
@@ -978,29 +1327,31 @@ Foo::Bar#bother
|
|
978
1327
|
@override.comment = 'must be displayed'
|
979
1328
|
@override.record_location @top_level
|
980
1329
|
|
981
|
-
@store2.
|
982
|
-
@store2.save_class @cBar
|
983
|
-
@store2.save_class @cFoo_Baz
|
984
|
-
|
985
|
-
@store2.save_method @cBar, @override
|
986
|
-
@store2.save_method @cBar, @baz
|
987
|
-
|
988
|
-
@store2.save_cache
|
1330
|
+
@store2.save
|
989
1331
|
|
990
1332
|
@driver.stores = [@store1, @store2]
|
991
|
-
|
992
|
-
RDoc::RDoc.reset
|
993
1333
|
end
|
994
1334
|
|
995
1335
|
def util_store
|
996
|
-
@
|
1336
|
+
@store1 = RDoc::RI::Store.new @home_ri, :home
|
1337
|
+
|
1338
|
+
@top_level = @store1.add_file 'file.rb'
|
997
1339
|
|
998
|
-
@
|
1340
|
+
@readme = @store1.add_file 'README.rdoc'
|
1341
|
+
@readme.parser = RDoc::Parser::Simple
|
1342
|
+
@readme.comment =
|
1343
|
+
doc(
|
1344
|
+
head(1, 'README'),
|
1345
|
+
para('This is a README'))
|
999
1346
|
|
1000
1347
|
@cFoo = @top_level.add_class RDoc::NormalClass, 'Foo'
|
1348
|
+
@mExt = @top_level.add_module RDoc::NormalModule, 'Ext'
|
1001
1349
|
@mInc = @top_level.add_module RDoc::NormalModule, 'Inc'
|
1002
1350
|
@cAmbiguous = @top_level.add_class RDoc::NormalClass, 'Ambiguous'
|
1003
1351
|
|
1352
|
+
doc = @RM::Document.new @RM::Paragraph.new('Extend thingy')
|
1353
|
+
@cFooExt = @cFoo.add_extend RDoc::Extend.new('Ext', doc)
|
1354
|
+
@cFooExt.record_location @top_level
|
1004
1355
|
doc = @RM::Document.new @RM::Paragraph.new('Include thingy')
|
1005
1356
|
@cFooInc = @cFoo.add_include RDoc::Include.new('Inc', doc)
|
1006
1357
|
@cFooInc.record_location @top_level
|
@@ -1031,28 +1382,12 @@ Foo::Bar#bother
|
|
1031
1382
|
|
1032
1383
|
# overriden by Bar in multi_store
|
1033
1384
|
@overriden = @cFoo.add_method RDoc::AnyMethod.new(nil, 'override')
|
1034
|
-
@overriden.comment = 'must not be displayed'
|
1385
|
+
@overriden.comment = 'must not be displayed in Bar#override'
|
1035
1386
|
@overriden.record_location @top_level
|
1036
1387
|
|
1037
|
-
@
|
1038
|
-
@store.save_class @cFoo_Bar
|
1039
|
-
@store.save_class @cFoo_Baz
|
1040
|
-
@store.save_class @mInc
|
1041
|
-
@store.save_class @cAmbiguous
|
1042
|
-
|
1043
|
-
@store.save_method @cFoo_Bar, @blah
|
1044
|
-
@store.save_method @cFoo_Bar, @bother
|
1045
|
-
@store.save_method @cFoo_Bar, @new
|
1046
|
-
@store.save_method @cFoo_Bar, @attr
|
1047
|
-
|
1048
|
-
@store.save_method @cFoo, @inherit
|
1049
|
-
@store.save_method @cFoo, @overriden
|
1050
|
-
|
1051
|
-
@store.save_cache
|
1052
|
-
|
1053
|
-
@driver.stores = [@store]
|
1388
|
+
@store1.save
|
1054
1389
|
|
1055
|
-
|
1390
|
+
@driver.stores = [@store1]
|
1056
1391
|
end
|
1057
1392
|
|
1058
1393
|
end
|