rdoc 3.10.pre.3 → 3.10
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.rdoc +35 -4
- data/LEGAL.rdoc +27 -0
- data/Manifest.txt +1 -0
- data/Rakefile +4 -0
- data/TODO.rdoc +4 -0
- data/lib/gauntlet_rdoc.rb +36 -4
- data/lib/rdoc.rb +21 -2
- data/lib/rdoc/any_method.rb +6 -2
- data/lib/rdoc/class_module.rb +4 -0
- data/lib/rdoc/context.rb +1 -2
- data/lib/rdoc/generator/template/darkfish/class.rhtml +4 -2
- data/lib/rdoc/include.rb +19 -7
- data/lib/rdoc/markup/parser.rb +21 -4
- data/lib/rdoc/markup/to_html_crossref.rb +2 -0
- data/lib/rdoc/method_attr.rb +15 -2
- data/lib/rdoc/options.rb +229 -5
- data/lib/rdoc/parser/c.rb +19 -6
- data/lib/rdoc/parser/ruby.rb +3 -5
- data/lib/rdoc/rdoc.rb +33 -6
- data/lib/rdoc/ruby_lex.rb +4 -3
- data/lib/rdoc/test_case.rb +17 -0
- data/lib/rdoc/top_level.rb +8 -0
- data/test/test_rdoc_any_method.rb +9 -0
- data/test/test_rdoc_attr.rb +13 -0
- data/test/test_rdoc_class_module.rb +13 -0
- data/test/test_rdoc_context.rb +10 -10
- data/test/test_rdoc_cross_reference.rb +8 -8
- data/test/test_rdoc_markup_parser.rb +58 -0
- data/test/test_rdoc_markup_to_html_crossref.rb +16 -8
- data/test/test_rdoc_method_attr.rb +13 -0
- data/test/test_rdoc_options.rb +161 -13
- data/test/test_rdoc_parser_c.rb +15 -0
- data/test/test_rdoc_rdoc.rb +35 -16
- data/test/test_rdoc_ruby_lex.rb +19 -0
- data/test/test_rdoc_top_level.rb +9 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
data/test/test_rdoc_options.rb
CHANGED
@@ -15,37 +15,112 @@ class TestRDocOptions < RDoc::TestCase
|
|
15
15
|
RDoc::RDoc::GENERATORS.replace @generators
|
16
16
|
end
|
17
17
|
|
18
|
+
def mu_pp obj
|
19
|
+
s = ''
|
20
|
+
s = PP.pp obj, s
|
21
|
+
s = s.force_encoding Encoding.default_external if defined? Encoding
|
22
|
+
s.chomp
|
23
|
+
end
|
24
|
+
|
18
25
|
def test_check_files
|
19
26
|
skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
|
27
|
+
|
20
28
|
out, err = capture_io do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
FileUtils.chmod 0, 'unreadable'
|
29
|
+
temp_dir do
|
30
|
+
FileUtils.touch 'unreadable'
|
31
|
+
FileUtils.chmod 0, 'unreadable'
|
25
32
|
|
26
|
-
|
33
|
+
@options.files = %w[nonexistent unreadable]
|
27
34
|
|
28
|
-
|
29
|
-
end
|
35
|
+
@options.check_files
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
33
39
|
assert_empty @options.files
|
34
40
|
|
35
|
-
|
41
|
+
assert_empty out
|
42
|
+
assert_empty err
|
43
|
+
end
|
36
44
|
|
37
|
-
|
38
|
-
|
39
|
-
file 'unreadable' not readable
|
40
|
-
EXPECTED
|
45
|
+
def test_check_files_warn
|
46
|
+
@options.verbosity = 2
|
41
47
|
|
42
|
-
|
48
|
+
out, err = capture_io do
|
49
|
+
@options.files = %w[nonexistent]
|
50
|
+
|
51
|
+
@options.check_files
|
52
|
+
end
|
53
|
+
|
54
|
+
assert_empty out
|
55
|
+
assert_equal "file 'nonexistent' not found\n", err
|
56
|
+
assert_empty @options.files
|
43
57
|
end
|
44
58
|
|
45
59
|
def test_dry_run_default
|
46
60
|
refute @options.dry_run
|
47
61
|
end
|
48
62
|
|
63
|
+
def test_encode_with
|
64
|
+
coder = {}
|
65
|
+
class << coder; alias add []=; end
|
66
|
+
|
67
|
+
@options.encode_with coder
|
68
|
+
|
69
|
+
encoding = Object.const_defined?(:Encoding) ? 'UTF-8' : nil
|
70
|
+
|
71
|
+
expected = {
|
72
|
+
'charset' => 'UTF-8',
|
73
|
+
'encoding' => encoding,
|
74
|
+
'exclude' => [],
|
75
|
+
'hyperlink_all' => false,
|
76
|
+
'line_numbers' => false,
|
77
|
+
'main_page' => nil,
|
78
|
+
'markup' => 'rdoc',
|
79
|
+
'rdoc_include' => [],
|
80
|
+
'show_hash' => false,
|
81
|
+
'static_path' => [],
|
82
|
+
'tab_width' => 8,
|
83
|
+
'title' => nil,
|
84
|
+
'visibility' => :protected,
|
85
|
+
'webcvs' => nil,
|
86
|
+
}
|
87
|
+
|
88
|
+
assert_equal expected, coder
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_encode_with_trim_paths
|
92
|
+
subdir = nil
|
93
|
+
coder = {}
|
94
|
+
class << coder; alias add []=; end
|
95
|
+
|
96
|
+
temp_dir do |dir|
|
97
|
+
FileUtils.mkdir 'project'
|
98
|
+
FileUtils.mkdir 'dir'
|
99
|
+
FileUtils.touch 'file'
|
100
|
+
|
101
|
+
Dir.chdir 'project' do
|
102
|
+
subdir = File.expand_path 'subdir'
|
103
|
+
FileUtils.mkdir 'subdir'
|
104
|
+
@options.parse %w[
|
105
|
+
--copy subdir
|
106
|
+
--copy ../file
|
107
|
+
--copy ../
|
108
|
+
--copy /
|
109
|
+
--include subdir
|
110
|
+
--include ../dir
|
111
|
+
--include ../
|
112
|
+
--include /
|
113
|
+
]
|
114
|
+
|
115
|
+
@options.encode_with coder
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
assert_equal [subdir], coder['rdoc_include']
|
120
|
+
|
121
|
+
assert_equal [subdir], coder['static_path']
|
122
|
+
end
|
123
|
+
|
49
124
|
def test_encoding_default
|
50
125
|
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
51
126
|
|
@@ -66,6 +141,34 @@ file 'unreadable' not readable
|
|
66
141
|
assert_equal expected, @options.generator_descriptions
|
67
142
|
end
|
68
143
|
|
144
|
+
def test_init_with_encoding
|
145
|
+
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
146
|
+
RDoc.load_yaml
|
147
|
+
|
148
|
+
@options.encoding = Encoding::IBM437
|
149
|
+
|
150
|
+
options = YAML.load YAML.dump @options
|
151
|
+
|
152
|
+
assert_equal Encoding::IBM437, options.encoding
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_init_with_trim_paths
|
156
|
+
RDoc.load_yaml
|
157
|
+
|
158
|
+
yaml = <<-YAML
|
159
|
+
--- !ruby/object:RDoc::Options
|
160
|
+
static_path:
|
161
|
+
- /etc
|
162
|
+
rdoc_include:
|
163
|
+
- /etc
|
164
|
+
YAML
|
165
|
+
|
166
|
+
options = YAML.load yaml
|
167
|
+
|
168
|
+
assert_empty options.rdoc_include
|
169
|
+
assert_empty options.static_path
|
170
|
+
end
|
171
|
+
|
69
172
|
def test_parse_copy_files_file_relative
|
70
173
|
file = File.basename __FILE__
|
71
174
|
expected = File.expand_path __FILE__
|
@@ -376,6 +479,23 @@ file 'unreadable' not readable
|
|
376
479
|
$LOAD_PATH.replace orig_LOAD_PATH
|
377
480
|
end
|
378
481
|
|
482
|
+
def test_parse_write_options
|
483
|
+
tmpdir = File.join Dir.tmpdir, "test_rdoc_options_#{$$}"
|
484
|
+
FileUtils.mkdir_p tmpdir
|
485
|
+
|
486
|
+
Dir.chdir tmpdir do
|
487
|
+
e = assert_raises SystemExit do
|
488
|
+
@options.parse %w[--write-options]
|
489
|
+
end
|
490
|
+
|
491
|
+
assert_equal 0, e.status
|
492
|
+
|
493
|
+
assert File.exist? '.rdoc_options'
|
494
|
+
end
|
495
|
+
ensure
|
496
|
+
FileUtils.rm_rf tmpdir
|
497
|
+
end
|
498
|
+
|
379
499
|
def test_setup_generator
|
380
500
|
test_generator = Class.new do
|
381
501
|
def self.setup_options op
|
@@ -427,5 +547,33 @@ file 'unreadable' not readable
|
|
427
547
|
refute @options.update_output_dir
|
428
548
|
end
|
429
549
|
|
550
|
+
def test_warn
|
551
|
+
out, err = capture_io do
|
552
|
+
@options.warn "warnings off"
|
553
|
+
end
|
554
|
+
|
555
|
+
assert_empty out
|
556
|
+
assert_empty err
|
557
|
+
|
558
|
+
@options.verbosity = 2
|
559
|
+
|
560
|
+
out, err = capture_io do
|
561
|
+
@options.warn "warnings on"
|
562
|
+
end
|
563
|
+
|
564
|
+
assert_empty out
|
565
|
+
assert_equal "warnings on\n", err
|
566
|
+
end
|
567
|
+
|
568
|
+
def test_write_options
|
569
|
+
temp_dir do |dir|
|
570
|
+
@options.write_options
|
571
|
+
|
572
|
+
assert File.exist? '.rdoc_options'
|
573
|
+
|
574
|
+
assert_equal @options, YAML.load(File.read('.rdoc_options'))
|
575
|
+
end
|
576
|
+
end
|
577
|
+
|
430
578
|
end
|
431
579
|
|
data/test/test_rdoc_parser_c.rb
CHANGED
@@ -57,6 +57,7 @@ class TestRDocParserC < RDoc::TestCase
|
|
57
57
|
@top_level = RDoc::TopLevel.new filename
|
58
58
|
@fn = filename
|
59
59
|
@options = RDoc::Options.new
|
60
|
+
@options.verbosity = 2
|
60
61
|
@stats = RDoc::Stats.new 0
|
61
62
|
end
|
62
63
|
|
@@ -263,6 +264,20 @@ VALUE cFoo = rb_define_class("Foo", rb_cObject);
|
|
263
264
|
assert_equal "this is the Foo class", klass.comment.text
|
264
265
|
end
|
265
266
|
|
267
|
+
def test_do_classes_struct
|
268
|
+
content = <<-EOF
|
269
|
+
/* Document-class: Foo
|
270
|
+
* this is the Foo class
|
271
|
+
*/
|
272
|
+
VALUE cFoo = rb_struct_define_without_accessor(
|
273
|
+
"Foo", rb_cObject, foo_alloc,
|
274
|
+
"some", "various", "fields", NULL);
|
275
|
+
EOF
|
276
|
+
|
277
|
+
klass = util_get_class content, 'cFoo'
|
278
|
+
assert_equal "this is the Foo class", klass.comment.text
|
279
|
+
end
|
280
|
+
|
266
281
|
def test_do_classes_class_under
|
267
282
|
content = <<-EOF
|
268
283
|
/* Document-class: Kernel::Foo
|
data/test/test_rdoc_rdoc.rb
CHANGED
@@ -42,6 +42,41 @@ class TestRDocRDoc < RDoc::TestCase
|
|
42
42
|
assert_equal [file], @rdoc.gather_files([file, file])
|
43
43
|
end
|
44
44
|
|
45
|
+
def test_load_options
|
46
|
+
temp_dir do
|
47
|
+
options = RDoc::Options.new
|
48
|
+
options.markup = 'tomdoc'
|
49
|
+
options.write_options
|
50
|
+
|
51
|
+
options = @rdoc.load_options
|
52
|
+
|
53
|
+
assert_equal 'tomdoc', options.markup
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_load_options_invalid
|
58
|
+
temp_dir do
|
59
|
+
open '.rdoc_options', 'w' do |io|
|
60
|
+
io.write "a: !ruby.yaml.org,2002:str |\nfoo"
|
61
|
+
end
|
62
|
+
|
63
|
+
e = assert_raises RDoc::Error do
|
64
|
+
@rdoc.load_options
|
65
|
+
end
|
66
|
+
|
67
|
+
options_file = File.expand_path '.rdoc_options'
|
68
|
+
assert_equal "#{options_file} is not a valid rdoc options file", e.message
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def load_options_no_file
|
73
|
+
temp_dir do
|
74
|
+
options = @rdoc.load_options
|
75
|
+
|
76
|
+
assert_kind_of RDoc::Options, options
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
45
80
|
def test_normalized_file_list
|
46
81
|
files = @rdoc.normalized_file_list [__FILE__]
|
47
82
|
|
@@ -88,8 +123,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
88
123
|
end
|
89
124
|
|
90
125
|
def test_setup_output_dir
|
91
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
92
|
-
|
93
126
|
Dir.mktmpdir {|d|
|
94
127
|
path = File.join d, 'testdir'
|
95
128
|
|
@@ -103,8 +136,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
103
136
|
end
|
104
137
|
|
105
138
|
def test_setup_output_dir_dry_run
|
106
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
107
|
-
|
108
139
|
@rdoc.options.dry_run = true
|
109
140
|
|
110
141
|
Dir.mktmpdir do |d|
|
@@ -117,8 +148,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
117
148
|
end
|
118
149
|
|
119
150
|
def test_setup_output_dir_exists
|
120
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
121
|
-
|
122
151
|
Dir.mktmpdir {|path|
|
123
152
|
open @rdoc.output_flag_file(path), 'w' do |io|
|
124
153
|
io.puts Time.at 0
|
@@ -133,8 +162,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
133
162
|
end
|
134
163
|
|
135
164
|
def test_setup_output_dir_exists_empty_created_rid
|
136
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
137
|
-
|
138
165
|
Dir.mktmpdir {|path|
|
139
166
|
open @rdoc.output_flag_file(path), 'w' do end
|
140
167
|
|
@@ -160,8 +187,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
160
187
|
end
|
161
188
|
|
162
189
|
def test_setup_output_dir_exists_not_rdoc
|
163
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
164
|
-
|
165
190
|
Dir.mktmpdir do |dir|
|
166
191
|
e = assert_raises RDoc::Error do
|
167
192
|
@rdoc.setup_output_dir dir, false
|
@@ -172,8 +197,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
172
197
|
end
|
173
198
|
|
174
199
|
def test_update_output_dir
|
175
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
176
|
-
|
177
200
|
Dir.mktmpdir do |d|
|
178
201
|
@rdoc.update_output_dir d, Time.now, {}
|
179
202
|
|
@@ -182,8 +205,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
182
205
|
end
|
183
206
|
|
184
207
|
def test_update_output_dir_dont
|
185
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
186
|
-
|
187
208
|
Dir.mktmpdir do |d|
|
188
209
|
@rdoc.options.update_output_dir = false
|
189
210
|
@rdoc.update_output_dir d, Time.now, {}
|
@@ -193,8 +214,6 @@ class TestRDocRDoc < RDoc::TestCase
|
|
193
214
|
end
|
194
215
|
|
195
216
|
def test_update_output_dir_dry_run
|
196
|
-
skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir
|
197
|
-
|
198
217
|
Dir.mktmpdir do |d|
|
199
218
|
@rdoc.options.dry_run = true
|
200
219
|
@rdoc.update_output_dir d, Time.now, {}
|
data/test/test_rdoc_ruby_lex.rb
CHANGED
@@ -50,6 +50,25 @@ STRING
|
|
50
50
|
assert_equal expected, tokens
|
51
51
|
end
|
52
52
|
|
53
|
+
def test_class_tokenize_heredoc_percent_N
|
54
|
+
tokens = RDoc::RubyLex.tokenize <<-'RUBY', nil
|
55
|
+
a b <<-U
|
56
|
+
%N
|
57
|
+
U
|
58
|
+
RUBY
|
59
|
+
|
60
|
+
expected = [
|
61
|
+
@TK::TkIDENTIFIER.new( 0, 1, 0, 'a'),
|
62
|
+
@TK::TkSPACE .new( 1, 1, 1, ' '),
|
63
|
+
@TK::TkIDENTIFIER.new( 2, 1, 2, 'b'),
|
64
|
+
@TK::TkSPACE .new( 3, 1, 3, ' '),
|
65
|
+
@TK::TkSTRING .new( 4, 1, 4, %Q{"%N\n"}),
|
66
|
+
@TK::TkNL .new(13, 3, 14, "\n"),
|
67
|
+
]
|
68
|
+
|
69
|
+
assert_equal expected, tokens
|
70
|
+
end
|
71
|
+
|
53
72
|
def test_unary_minus
|
54
73
|
ruby_lex = RDoc::RubyLex.new("-1", nil)
|
55
74
|
assert_equal("-1", ruby_lex.token.value)
|
data/test/test_rdoc_top_level.rb
CHANGED
@@ -191,6 +191,15 @@ class TestRDocTopLevel < XrefTestCase
|
|
191
191
|
assert_equal 'top_level.rb', @top_level.base_name
|
192
192
|
end
|
193
193
|
|
194
|
+
def test_display_eh
|
195
|
+
refute @top_level.display?
|
196
|
+
|
197
|
+
page = RDoc::TopLevel.new 'README.txt'
|
198
|
+
page.parser = RDoc::Parser::Simple
|
199
|
+
|
200
|
+
assert page.display?
|
201
|
+
end
|
202
|
+
|
194
203
|
def test_eql_eh
|
195
204
|
top_level2 = RDoc::TopLevel.new 'path/top_level.rb'
|
196
205
|
other_level = RDoc::TopLevel.new 'path/other_level.rb'
|
metadata
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 10
|
9
|
-
|
10
|
-
- 3
|
11
|
-
version: 3.10.pre.3
|
9
|
+
version: "3.10"
|
12
10
|
platform: ruby
|
13
11
|
authors:
|
14
12
|
- Eric Hodel
|
@@ -40,7 +38,7 @@ cert_chain:
|
|
40
38
|
x52qPcexcYZR7w==
|
41
39
|
-----END CERTIFICATE-----
|
42
40
|
|
43
|
-
date: 2011-10-
|
41
|
+
date: 2011-10-08 00:00:00 Z
|
44
42
|
dependencies:
|
45
43
|
- !ruby/object:Gem::Dependency
|
46
44
|
name: json
|
@@ -150,6 +148,7 @@ extra_rdoc_files:
|
|
150
148
|
- Manifest.txt
|
151
149
|
- History.rdoc
|
152
150
|
- LICENSE.rdoc
|
151
|
+
- LEGAL.rdoc
|
153
152
|
- README.rdoc
|
154
153
|
- RI.rdoc
|
155
154
|
- TODO.rdoc
|
@@ -158,6 +157,7 @@ files:
|
|
158
157
|
- .autotest
|
159
158
|
- .document
|
160
159
|
- History.rdoc
|
160
|
+
- LEGAL.rdoc
|
161
161
|
- LICENSE.rdoc
|
162
162
|
- Manifest.txt
|
163
163
|
- README.rdoc
|
metadata.gz.sig
CHANGED
Binary file
|