rdoc 3.6.1 → 3.7
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.
- data.tar.gz.sig +0 -0
- data/History.txt +45 -0
- data/Manifest.txt +4 -0
- data/lib/rdoc.rb +3 -2
- data/lib/rdoc/any_method.rb +12 -7
- data/lib/rdoc/attr.rb +16 -1
- data/lib/rdoc/class_module.rb +156 -42
- data/lib/rdoc/code_object.rb +8 -1
- data/lib/rdoc/context.rb +75 -29
- data/lib/rdoc/generator/markup.rb +3 -1
- data/lib/rdoc/generator/ri.rb +3 -2
- data/lib/rdoc/generator/template/darkfish/rdoc.css +4 -0
- data/lib/rdoc/known_classes.rb +2 -2
- data/lib/rdoc/markup.rb +63 -18
- data/lib/rdoc/markup/document.rb +43 -4
- data/lib/rdoc/markup/formatter.rb +13 -3
- data/lib/rdoc/markup/formatter_test_case.rb +13 -3
- data/lib/rdoc/markup/indented_paragraph.rb +33 -0
- data/lib/rdoc/markup/inline.rb +8 -1
- data/lib/rdoc/markup/parser.rb +1 -0
- data/lib/rdoc/markup/pre_process.rb +7 -0
- data/lib/rdoc/markup/to_ansi.rb +4 -4
- data/lib/rdoc/markup/to_bs.rb +1 -1
- data/lib/rdoc/markup/to_html.rb +2 -2
- data/lib/rdoc/markup/to_html_crossref.rb +3 -2
- data/lib/rdoc/markup/to_rdoc.rb +10 -1
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +1 -1
- data/lib/rdoc/parser.rb +1 -1
- data/lib/rdoc/parser/c.rb +69 -26
- data/lib/rdoc/parser/ruby.rb +19 -9
- data/lib/rdoc/rdoc.rb +14 -3
- data/lib/rdoc/ri/driver.rb +137 -103
- data/lib/rdoc/ri/store.rb +111 -26
- data/lib/rdoc/ruby_lex.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +220 -0
- data/lib/rdoc/text.rb +1 -1
- data/lib/rdoc/top_level.rb +31 -0
- data/test/test_rdoc_any_method.rb +68 -0
- data/test/test_rdoc_attr.rb +62 -0
- data/test/test_rdoc_class_module.rb +459 -29
- data/test/test_rdoc_code_object.rb +17 -0
- data/test/test_rdoc_context.rb +70 -0
- data/test/test_rdoc_context_section.rb +1 -1
- data/test/test_rdoc_generator_ri.rb +14 -3
- data/test/test_rdoc_markup.rb +55 -1
- data/test/test_rdoc_markup_document.rb +83 -0
- data/test/test_rdoc_markup_indented_paragraph.rb +40 -0
- data/test/test_rdoc_markup_paragraph.rb +12 -0
- data/test/test_rdoc_markup_pre_process.rb +13 -2
- data/test/test_rdoc_markup_to_ansi.rb +4 -0
- data/test/test_rdoc_markup_to_bs.rb +4 -0
- data/test/test_rdoc_markup_to_html.rb +7 -3
- data/test/test_rdoc_markup_to_rdoc.rb +14 -0
- data/test/test_rdoc_markup_to_tt_only.rb +4 -0
- data/test/test_rdoc_parser_c.rb +302 -2
- data/test/test_rdoc_parser_ruby.rb +48 -1
- data/test/test_rdoc_rdoc.rb +41 -10
- data/test/test_rdoc_ri_driver.rb +40 -7
- data/test/test_rdoc_ri_store.rb +111 -23
- data/test/test_rdoc_rubygems_hook.rb +201 -0
- data/test/test_rdoc_stats.rb +12 -12
- data/test/test_rdoc_text.rb +17 -0
- data/test/test_rdoc_top_level.rb +35 -0
- metadata +18 -14
- metadata.gz.sig +0 -0
data/test/test_rdoc_rdoc.rb
CHANGED
@@ -16,12 +16,27 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
|
|
16
16
|
|
17
17
|
@stats = RDoc::Stats.new 0, 0
|
18
18
|
@rdoc.instance_variable_set :@stats, @stats
|
19
|
-
|
20
|
-
@tempfile = Tempfile.new 'test_rdoc_rdoc'
|
21
19
|
end
|
22
20
|
|
23
|
-
def
|
24
|
-
|
21
|
+
def test_class_reset
|
22
|
+
tl = RDoc::TopLevel.new 'file.rb'
|
23
|
+
tl.add_class RDoc::NormalClass, 'C'
|
24
|
+
tl.add_class RDoc::NormalModule, 'M'
|
25
|
+
|
26
|
+
c = RDoc::Parser::C
|
27
|
+
enclosure_classes = c.send :class_variable_get, :@@enclosure_classes
|
28
|
+
enclosure_classes['A'] = 'B'
|
29
|
+
known_bodies = c.send :class_variable_get, :@@known_bodies
|
30
|
+
known_bodies['A'] = 'B'
|
31
|
+
|
32
|
+
RDoc::RDoc.reset
|
33
|
+
|
34
|
+
assert_empty RDoc::TopLevel.all_classes_hash
|
35
|
+
assert_empty RDoc::TopLevel.all_files_hash
|
36
|
+
assert_empty RDoc::TopLevel.all_modules_hash
|
37
|
+
|
38
|
+
assert_empty c.send :class_variable_get, :@@enclosure_classes
|
39
|
+
assert_empty c.send :class_variable_get, :@@known_bodies
|
25
40
|
end
|
26
41
|
|
27
42
|
def test_gather_files
|
@@ -47,6 +62,20 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
|
|
47
62
|
assert_empty files
|
48
63
|
end
|
49
64
|
|
65
|
+
def test_parse_file_encoding
|
66
|
+
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
67
|
+
@rdoc.options.encoding = Encoding::ISO_8859_1
|
68
|
+
|
69
|
+
Tempfile.open 'test.txt' do |io|
|
70
|
+
io.write 'hi'
|
71
|
+
io.rewind
|
72
|
+
|
73
|
+
top_level = @rdoc.parse_file io.path
|
74
|
+
|
75
|
+
assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
50
79
|
def test_remove_unparseable
|
51
80
|
file_list = %w[
|
52
81
|
blah.class
|
@@ -120,14 +149,16 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
|
|
120
149
|
end
|
121
150
|
|
122
151
|
def test_setup_output_dir_exists_file
|
123
|
-
|
152
|
+
Tempfile.open 'test_rdoc_rdoc' do |tempfile|
|
153
|
+
path = tempfile.path
|
124
154
|
|
125
|
-
|
126
|
-
|
127
|
-
|
155
|
+
e = assert_raises RDoc::Error do
|
156
|
+
@rdoc.setup_output_dir path, false
|
157
|
+
end
|
128
158
|
|
129
|
-
|
130
|
-
|
159
|
+
assert_match(%r%#{Regexp.escape path} exists and is not a directory%,
|
160
|
+
e.message)
|
161
|
+
end
|
131
162
|
end
|
132
163
|
|
133
164
|
def test_setup_output_dir_exists_not_rdoc
|
data/test/test_rdoc_ri_driver.rb
CHANGED
@@ -22,11 +22,11 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
|
|
22
22
|
ENV['HOME'] = @tmpdir
|
23
23
|
ENV.delete 'RI'
|
24
24
|
|
25
|
-
options = RDoc::RI::Driver.process_args []
|
26
|
-
options[:home] = @tmpdir
|
27
|
-
options[:use_stdout] = true
|
28
|
-
options[:formatter] = @RM::ToRdoc
|
29
|
-
@driver = RDoc::RI::Driver.new options
|
25
|
+
@options = RDoc::RI::Driver.process_args []
|
26
|
+
@options[:home] = @tmpdir
|
27
|
+
@options[:use_stdout] = true
|
28
|
+
@options[:formatter] = @RM::ToRdoc
|
29
|
+
@driver = RDoc::RI::Driver.new @options
|
30
30
|
end
|
31
31
|
|
32
32
|
def teardown
|
@@ -191,12 +191,30 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
|
|
191
191
|
def test_add_method_list
|
192
192
|
out = @RM::Document.new
|
193
193
|
|
194
|
-
@driver.add_method_list out, %w[new], 'Class methods'
|
194
|
+
@driver.add_method_list out, %w[new parse], 'Class methods'
|
195
195
|
|
196
196
|
expected = @RM::Document.new(
|
197
197
|
@RM::Heading.new(1, 'Class methods:'),
|
198
198
|
@RM::BlankLine.new,
|
199
199
|
@RM::Verbatim.new('new'),
|
200
|
+
@RM::Verbatim.new('parse'),
|
201
|
+
@RM::BlankLine.new)
|
202
|
+
|
203
|
+
assert_equal expected, out
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_add_method_list_interative
|
207
|
+
@options[:interactive] = true
|
208
|
+
driver = RDoc::RI::Driver.new @options
|
209
|
+
|
210
|
+
out = @RM::Document.new
|
211
|
+
|
212
|
+
driver.add_method_list out, %w[new parse], 'Class methods'
|
213
|
+
|
214
|
+
expected = @RM::Document.new(
|
215
|
+
@RM::Heading.new(1, 'Class methods:'),
|
216
|
+
@RM::BlankLine.new,
|
217
|
+
@RM::IndentedParagraph.new(2, 'new, parse'),
|
200
218
|
@RM::BlankLine.new)
|
201
219
|
|
202
220
|
assert_equal expected, out
|
@@ -272,6 +290,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
|
|
272
290
|
def test_complete_classes
|
273
291
|
util_store
|
274
292
|
|
293
|
+
assert_equal %w[ ], @driver.complete('[')
|
294
|
+
assert_equal %w[ ], @driver.complete('[::')
|
275
295
|
assert_equal %w[Foo ], @driver.complete('F')
|
276
296
|
assert_equal %w[Foo:: Foo::Bar Foo::Baz], @driver.complete('Foo::')
|
277
297
|
assert_equal %w[ Foo::Bar Foo::Baz], @driver.complete('Foo::B')
|
@@ -621,11 +641,13 @@ Foo::Bar#bother
|
|
621
641
|
util_store
|
622
642
|
|
623
643
|
index = RDoc::AnyMethod.new nil, '[]'
|
644
|
+
index.record_location @top_level
|
624
645
|
@cFoo.add_method index
|
625
646
|
@store.save_method @cFoo, index
|
626
647
|
|
627
648
|
c_index = RDoc::AnyMethod.new nil, '[]'
|
628
649
|
c_index.singleton = true
|
650
|
+
c_index.record_location @top_level
|
629
651
|
@cFoo.add_method c_index
|
630
652
|
@store.save_method @cFoo, c_index
|
631
653
|
|
@@ -858,10 +880,12 @@ Foo::Bar#bother
|
|
858
880
|
@cFoo_Baz.parent = @cFoo
|
859
881
|
|
860
882
|
@baz = RDoc::AnyMethod.new nil, 'baz'
|
883
|
+
@baz.record_location @top_level
|
861
884
|
@cBar.add_method @baz
|
862
885
|
|
863
886
|
@override = RDoc::AnyMethod.new nil, 'override'
|
864
887
|
@override.comment = 'must be displayed'
|
888
|
+
@override.record_location @top_level
|
865
889
|
@cBar.add_method @override
|
866
890
|
|
867
891
|
@store2.save_class @mAmbiguous
|
@@ -879,6 +903,8 @@ Foo::Bar#bother
|
|
879
903
|
def util_store
|
880
904
|
@store = RDoc::RI::Store.new @home_ri
|
881
905
|
|
906
|
+
@top_level = RDoc::TopLevel.new 'file.rb'
|
907
|
+
|
882
908
|
@cFoo = RDoc::NormalClass.new 'Foo'
|
883
909
|
@mInc = RDoc::NormalModule.new 'Inc'
|
884
910
|
@cAmbiguous = RDoc::NormalClass.new 'Ambiguous'
|
@@ -886,6 +912,7 @@ Foo::Bar#bother
|
|
886
912
|
doc = @RM::Document.new @RM::Paragraph.new('Include thingy')
|
887
913
|
|
888
914
|
@cFooInc = RDoc::Include.new 'Inc', doc
|
915
|
+
@cFooInc.record_location @top_level
|
889
916
|
@cFoo.add_include @cFooInc
|
890
917
|
|
891
918
|
@cFoo_Bar = RDoc::NormalClass.new 'Bar'
|
@@ -893,12 +920,15 @@ Foo::Bar#bother
|
|
893
920
|
|
894
921
|
@blah = RDoc::AnyMethod.new nil, 'blah'
|
895
922
|
@blah.call_seq = "blah(5) => 5\nblah(6) => 6\n"
|
923
|
+
@blah.record_location @top_level
|
896
924
|
|
897
925
|
@bother = RDoc::AnyMethod.new nil, 'bother'
|
898
|
-
@bother.params = "(things)"
|
899
926
|
@bother.block_params = "stuff"
|
927
|
+
@bother.params = "(things)"
|
928
|
+
@bother.record_location @top_level
|
900
929
|
|
901
930
|
@new = RDoc::AnyMethod.new nil, 'new'
|
931
|
+
@new.record_location @top_level
|
902
932
|
@new.singleton = true
|
903
933
|
|
904
934
|
@cFoo_Bar.add_method @blah
|
@@ -906,6 +936,7 @@ Foo::Bar#bother
|
|
906
936
|
@cFoo_Bar.add_method @new
|
907
937
|
|
908
938
|
@attr = RDoc::Attr.new nil, 'attr', 'RW', ''
|
939
|
+
@attr.record_location @top_level
|
909
940
|
|
910
941
|
@cFoo_Bar.add_attribute @attr
|
911
942
|
|
@@ -913,11 +944,13 @@ Foo::Bar#bother
|
|
913
944
|
@cFoo_Baz.parent = @cFoo
|
914
945
|
|
915
946
|
@inherit = RDoc::AnyMethod.new nil, 'inherit'
|
947
|
+
@inherit.record_location @top_level
|
916
948
|
@cFoo.add_method @inherit
|
917
949
|
|
918
950
|
# overriden by Bar in multi_store
|
919
951
|
@overriden = RDoc::AnyMethod.new nil, 'override'
|
920
952
|
@overriden.comment = 'must not be displayed'
|
953
|
+
@overriden.record_location @top_level
|
921
954
|
@cFoo.add_method @overriden
|
922
955
|
|
923
956
|
@store.save_class @cFoo
|
data/test/test_rdoc_ri_store.rb
CHANGED
@@ -4,9 +4,12 @@ require 'rdoc/ri'
|
|
4
4
|
require 'rdoc/markup'
|
5
5
|
require 'tmpdir'
|
6
6
|
require 'fileutils'
|
7
|
+
require 'pp'
|
7
8
|
|
8
9
|
class TestRDocRIStore < MiniTest::Unit::TestCase
|
9
10
|
|
11
|
+
OBJECT_ANCESTORS = defined?(::BasicObject) ? %w[BasicObject] : []
|
12
|
+
|
10
13
|
def setup
|
11
14
|
RDoc::TopLevel.reset
|
12
15
|
|
@@ -16,15 +19,20 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
16
19
|
@top_level = RDoc::TopLevel.new 'file.rb'
|
17
20
|
|
18
21
|
@klass = @top_level.add_class RDoc::NormalClass, 'Object'
|
19
|
-
@klass.
|
22
|
+
@klass.add_comment 'original', @top_level
|
20
23
|
|
21
24
|
@cmeth = RDoc::AnyMethod.new nil, 'cmethod'
|
22
25
|
@cmeth.singleton = true
|
26
|
+
@cmeth.record_location @top_level
|
23
27
|
|
24
28
|
@meth = RDoc::AnyMethod.new nil, 'method'
|
29
|
+
@meth.record_location @top_level
|
30
|
+
|
25
31
|
@meth_bang = RDoc::AnyMethod.new nil, 'method!'
|
32
|
+
@meth_bang.record_location @top_level
|
26
33
|
|
27
34
|
@attr = RDoc::Attr.new nil, 'attr', 'RW', ''
|
35
|
+
@attr.record_location @top_level
|
28
36
|
|
29
37
|
@klass.add_method @cmeth
|
30
38
|
@klass.add_method @meth
|
@@ -33,7 +41,10 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
33
41
|
|
34
42
|
@nest_klass = @klass.add_class RDoc::NormalClass, 'SubClass'
|
35
43
|
@nest_meth = RDoc::AnyMethod.new nil, 'method'
|
44
|
+
@nest_meth.record_location @top_level
|
45
|
+
|
36
46
|
@nest_incl = RDoc::Include.new 'Incl', ''
|
47
|
+
@nest_incl.record_location @top_level
|
37
48
|
|
38
49
|
@nest_klass.add_method @nest_meth
|
39
50
|
@nest_klass.add_include @nest_incl
|
@@ -45,15 +56,32 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
45
56
|
FileUtils.rm_rf @tmpdir
|
46
57
|
end
|
47
58
|
|
59
|
+
def mu_pp obj
|
60
|
+
s = ''
|
61
|
+
s = PP.pp obj, s
|
62
|
+
s.force_encoding Encoding.default_external if defined? Encoding
|
63
|
+
s.chomp
|
64
|
+
end
|
65
|
+
|
48
66
|
def assert_cache imethods, cmethods, attrs, modules, ancestors = {}
|
67
|
+
imethods ||= { 'Object' => %w[method method!] }
|
68
|
+
cmethods ||= { 'Object' => %w[cmethod] }
|
69
|
+
attrs ||= { 'Object' => ['attr_accessor attr'] }
|
70
|
+
|
71
|
+
# this is sort-of a hack
|
72
|
+
@s.clean_cache_collection ancestors
|
73
|
+
|
49
74
|
expected = {
|
75
|
+
:ancestors => ancestors,
|
76
|
+
:attributes => attrs,
|
50
77
|
:class_methods => cmethods,
|
78
|
+
:encoding => nil,
|
51
79
|
:instance_methods => imethods,
|
52
|
-
:attributes => attrs,
|
53
80
|
:modules => modules,
|
54
|
-
:ancestors => ancestors
|
55
81
|
}
|
56
82
|
|
83
|
+
@s.save_cache
|
84
|
+
|
57
85
|
assert_equal expected, @s.cache
|
58
86
|
end
|
59
87
|
|
@@ -138,8 +166,9 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
138
166
|
|
139
167
|
def test_load_cache
|
140
168
|
cache = {
|
141
|
-
:
|
142
|
-
:
|
169
|
+
:encoding => :encoding_value,
|
170
|
+
:methods => %w[Object#method],
|
171
|
+
:modules => %w[Object],
|
143
172
|
}
|
144
173
|
|
145
174
|
Dir.mkdir @tmpdir
|
@@ -151,6 +180,32 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
151
180
|
@s.load_cache
|
152
181
|
|
153
182
|
assert_equal cache, @s.cache
|
183
|
+
|
184
|
+
assert_equal :encoding_value, @s.encoding
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_load_cache_encoding_differs
|
188
|
+
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
189
|
+
|
190
|
+
cache = {
|
191
|
+
:encoding => Encoding::ISO_8859_1,
|
192
|
+
:methods => %w[Object#method],
|
193
|
+
:modules => %w[Object],
|
194
|
+
}
|
195
|
+
|
196
|
+
Dir.mkdir @tmpdir
|
197
|
+
|
198
|
+
open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
|
199
|
+
Marshal.dump cache, io
|
200
|
+
end
|
201
|
+
|
202
|
+
@s.encoding = Encoding::UTF_8
|
203
|
+
|
204
|
+
@s.load_cache
|
205
|
+
|
206
|
+
assert_equal cache, @s.cache
|
207
|
+
|
208
|
+
assert_equal Encoding::UTF_8, @s.encoding
|
154
209
|
end
|
155
210
|
|
156
211
|
def test_load_cache_no_cache
|
@@ -158,6 +213,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
158
213
|
:ancestors => {},
|
159
214
|
:attributes => {},
|
160
215
|
:class_methods => {},
|
216
|
+
:encoding => nil,
|
161
217
|
:instance_methods => {},
|
162
218
|
:modules => [],
|
163
219
|
}
|
@@ -199,6 +255,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
199
255
|
@s.save_method @klass, @meth
|
200
256
|
@s.save_method @klass, @cmeth
|
201
257
|
@s.save_class @nest_klass
|
258
|
+
@s.encoding = :encoding_value
|
202
259
|
|
203
260
|
@s.save_cache
|
204
261
|
|
@@ -207,12 +264,15 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
207
264
|
expected = {
|
208
265
|
:attributes => { 'Object' => ['attr_accessor attr'] },
|
209
266
|
:class_methods => { 'Object' => %w[cmethod] },
|
210
|
-
:instance_methods => {
|
267
|
+
:instance_methods => {
|
268
|
+
'Object' => %w[method method!],
|
269
|
+
'Object::SubClass' => %w[method],
|
270
|
+
},
|
211
271
|
:modules => %w[Object Object::SubClass],
|
212
272
|
:ancestors => {
|
213
|
-
'Object' => %w[],
|
214
273
|
'Object::SubClass' => %w[Incl Object],
|
215
274
|
},
|
275
|
+
:encoding => :encoding_value,
|
216
276
|
}
|
217
277
|
|
218
278
|
expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject)
|
@@ -252,10 +312,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
252
312
|
assert_directory File.join(@tmpdir, 'Object')
|
253
313
|
assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
|
254
314
|
|
255
|
-
|
256
|
-
|
257
|
-
assert_cache({}, {}, { 'Object' => ['attr_accessor attr'] }, %w[Object],
|
258
|
-
'Object' => object_ancestors)
|
315
|
+
assert_cache nil, nil, nil, %w[Object], 'Object' => OBJECT_ANCESTORS
|
259
316
|
|
260
317
|
assert_equal @klass, @s.load_class('Object')
|
261
318
|
end
|
@@ -268,12 +325,45 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
268
325
|
assert_directory File.join(@tmpdir, 'Object')
|
269
326
|
assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
|
270
327
|
|
271
|
-
assert_cache(
|
272
|
-
'Object' => %w[])
|
328
|
+
assert_cache(nil, nil, nil, %w[Object])
|
273
329
|
|
274
330
|
assert_equal @klass, @s.load_class('Object')
|
275
331
|
end
|
276
332
|
|
333
|
+
def test_save_class_delete
|
334
|
+
# save original
|
335
|
+
@s.save_class @klass
|
336
|
+
@s.save_method @klass, @meth
|
337
|
+
@s.save_method @klass, @meth_bang
|
338
|
+
@s.save_method @klass, @cmeth
|
339
|
+
@s.save_cache
|
340
|
+
|
341
|
+
klass = RDoc::NormalClass.new 'Object'
|
342
|
+
|
343
|
+
meth = klass.add_method RDoc::AnyMethod.new(nil, 'replace')
|
344
|
+
meth.record_location @top_level
|
345
|
+
|
346
|
+
# load original, save newly updated class
|
347
|
+
@s = RDoc::RI::Store.new @tmpdir
|
348
|
+
@s.load_cache
|
349
|
+
@s.save_class klass
|
350
|
+
@s.save_cache
|
351
|
+
|
352
|
+
# load from disk again
|
353
|
+
@s = RDoc::RI::Store.new @tmpdir
|
354
|
+
@s.load_cache
|
355
|
+
|
356
|
+
@s.load_class 'Object'
|
357
|
+
|
358
|
+
assert_cache({ 'Object' => %w[replace] }, {},
|
359
|
+
{ 'Object' => %w[attr_accessor\ attr] }, %w[Object],
|
360
|
+
'Object' => OBJECT_ANCESTORS)
|
361
|
+
|
362
|
+
refute File.exist? @s.method_file(@klass.full_name, @meth.full_name)
|
363
|
+
refute File.exist? @s.method_file(@klass.full_name, @meth_bang.full_name)
|
364
|
+
refute File.exist? @s.method_file(@klass.full_name, @cmeth.full_name)
|
365
|
+
end
|
366
|
+
|
277
367
|
def test_save_class_dry_run
|
278
368
|
@s.dry_run = true
|
279
369
|
|
@@ -287,16 +377,17 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
287
377
|
@s.save_class @klass
|
288
378
|
|
289
379
|
klass = RDoc::NormalClass.new 'Object'
|
290
|
-
klass.
|
380
|
+
klass.add_comment 'new comment', @top_level
|
291
381
|
|
292
382
|
s = RDoc::RI::Store.new @tmpdir
|
293
383
|
s.save_class klass
|
294
384
|
|
295
385
|
s = RDoc::RI::Store.new @tmpdir
|
296
386
|
|
297
|
-
|
298
|
-
|
299
|
-
|
387
|
+
inner = @RM::Document.new @RM::Paragraph.new 'new comment'
|
388
|
+
inner.file = @top_level.absolute_name
|
389
|
+
|
390
|
+
document = @RM::Document.new inner
|
300
391
|
|
301
392
|
assert_equal document, s.load_class('Object').comment
|
302
393
|
end
|
@@ -307,10 +398,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
307
398
|
assert_directory File.join(@tmpdir, 'Object')
|
308
399
|
assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
|
309
400
|
|
310
|
-
|
311
|
-
|
312
|
-
assert_cache({}, {}, { 'Object' => ['attr_accessor attr'] }, %w[Object],
|
313
|
-
'Object' => object_ancestors)
|
401
|
+
assert_cache nil, nil, nil, %w[Object], 'Object' => OBJECT_ANCESTORS
|
314
402
|
|
315
403
|
assert_equal @klass, @s.load_class('Object')
|
316
404
|
end
|
@@ -321,8 +409,8 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
321
409
|
assert_directory File.join(@tmpdir, 'Object', 'SubClass')
|
322
410
|
assert_file File.join(@tmpdir, 'Object', 'SubClass', 'cdesc-SubClass.ri')
|
323
411
|
|
324
|
-
assert_cache({}, {}, {},
|
325
|
-
'Object::SubClass' => %w[Incl Object])
|
412
|
+
assert_cache({ 'Object::SubClass' => %w[method] }, {}, {},
|
413
|
+
%w[Object::SubClass], 'Object::SubClass' => %w[Incl Object])
|
326
414
|
end
|
327
415
|
|
328
416
|
def test_save_method
|