rdoc 2.3.0 → 2.4.0

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.

Files changed (81) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +14 -0
  3. data/History.txt +27 -0
  4. data/Manifest.txt +29 -9
  5. data/Rakefile +2 -0
  6. data/bin/rdoc +13 -2
  7. data/lib/rdoc.rb +11 -3
  8. data/lib/rdoc/alias.rb +54 -0
  9. data/lib/rdoc/anon_class.rb +10 -0
  10. data/lib/rdoc/any_method.rb +190 -0
  11. data/lib/rdoc/attr.rb +79 -0
  12. data/lib/rdoc/cache.rb +11 -2
  13. data/lib/rdoc/class_module.rb +87 -0
  14. data/lib/rdoc/code_object.rb +152 -0
  15. data/lib/rdoc/code_objects.rb +18 -1118
  16. data/lib/rdoc/constant.rb +36 -0
  17. data/lib/rdoc/context.rb +712 -0
  18. data/lib/rdoc/diagram.rb +8 -8
  19. data/lib/rdoc/generator.rb +3 -1140
  20. data/lib/rdoc/generator/darkfish.rb +107 -133
  21. data/lib/rdoc/generator/markup.rb +194 -0
  22. data/lib/rdoc/generator/ri.rb +4 -2
  23. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +92 -113
  24. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +33 -35
  25. data/lib/rdoc/generator/template/darkfish/index.rhtml +22 -15
  26. data/lib/rdoc/ghost_method.rb +8 -0
  27. data/lib/rdoc/include.rb +39 -0
  28. data/lib/rdoc/markup/attribute_manager.rb +46 -0
  29. data/lib/rdoc/markup/formatter.rb +11 -0
  30. data/lib/rdoc/markup/fragments.rb +42 -2
  31. data/lib/rdoc/markup/inline.rb +29 -4
  32. data/lib/rdoc/markup/lines.rb +4 -0
  33. data/lib/rdoc/markup/preprocess.rb +4 -0
  34. data/lib/rdoc/markup/to_flow.rb +27 -1
  35. data/lib/rdoc/markup/to_html.rb +33 -33
  36. data/lib/rdoc/markup/to_html_crossref.rb +4 -11
  37. data/lib/rdoc/markup/to_latex.rb +31 -31
  38. data/lib/rdoc/markup/to_test.rb +3 -0
  39. data/lib/rdoc/markup/to_texinfo.rb +18 -14
  40. data/lib/rdoc/meta_method.rb +8 -0
  41. data/lib/rdoc/normal_class.rb +18 -0
  42. data/lib/rdoc/normal_module.rb +34 -0
  43. data/lib/rdoc/options.rb +26 -159
  44. data/lib/rdoc/parser/c.rb +16 -8
  45. data/lib/rdoc/parser/ruby.rb +16 -10
  46. data/lib/rdoc/parser/simple.rb +1 -1
  47. data/lib/rdoc/rdoc.rb +50 -34
  48. data/lib/rdoc/require.rb +32 -0
  49. data/lib/rdoc/ri/descriptions.rb +1 -1
  50. data/lib/rdoc/ri/driver.rb +4 -4
  51. data/lib/rdoc/ri/formatter.rb +70 -32
  52. data/lib/rdoc/single_class.rb +8 -0
  53. data/lib/rdoc/top_level.rb +232 -0
  54. data/test/test_rdoc_any_method.rb +10 -0
  55. data/test/test_rdoc_code_object.rb +80 -0
  56. data/test/test_rdoc_constant.rb +15 -0
  57. data/test/test_rdoc_context.rb +250 -0
  58. data/test/test_rdoc_include.rb +17 -0
  59. data/test/test_rdoc_markup.rb +13 -2
  60. data/test/test_rdoc_markup_to_html.rb +22 -0
  61. data/test/test_rdoc_markup_to_html_crossref.rb +50 -115
  62. data/test/test_rdoc_normal_module.rb +26 -0
  63. data/test/test_rdoc_parser_c.rb +33 -0
  64. data/test/test_rdoc_parser_ruby.rb +54 -36
  65. data/test/test_rdoc_require.rb +25 -0
  66. data/test/test_rdoc_ri_default_display.rb +2 -1
  67. data/test/test_rdoc_ri_html_formatter.rb +141 -0
  68. data/test/test_rdoc_top_level.rb +85 -0
  69. data/test/xref_data.rb +46 -0
  70. data/test/xref_test_case.rb +48 -0
  71. metadata +42 -13
  72. metadata.gz.sig +0 -0
  73. data/lib/rdoc/generator/html.rb +0 -456
  74. data/lib/rdoc/generator/html/common.rb +0 -24
  75. data/lib/rdoc/generator/html/html.rb +0 -769
  76. data/lib/rdoc/generator/html/one_page_html.rb +0 -122
  77. data/lib/rdoc/generator/xml.rb +0 -124
  78. data/lib/rdoc/generator/xml/rdf.rb +0 -113
  79. data/lib/rdoc/generator/xml/xml.rb +0 -123
  80. data/lib/rdoc/parser/f95.rb +0 -1835
  81. data/lib/rdoc/template.rb +0 -68
@@ -0,0 +1,17 @@
1
+ require 'test/xref_test_case'
2
+
3
+ class TestRDocInclude < XrefTestCase
4
+
5
+ def setup
6
+ super
7
+
8
+ @inc = RDoc::Include.new 'M1', 'comment'
9
+ end
10
+
11
+ def test_module
12
+ assert_equal @m1, @inc.module
13
+ assert_equal 'Unknown', RDoc::Include.new('Unknown', 'comment').module
14
+ end
15
+
16
+ end
17
+
@@ -18,12 +18,12 @@ class TestRDocMarkup < MiniTest::Unit::TestCase
18
18
 
19
19
  block = m.convert(str, mock)
20
20
 
21
- if block != expected
21
+ unless block == expected then
22
22
  rows = (0...([expected.size, block.size].max)).collect{|i|
23
23
  [expected[i]||"nil", block[i]||"nil"]
24
24
  }
25
25
  printf "\n\n%35s %35s\n", "Expected", "Got"
26
- rows.each {|e,g| printf "%35s %35s\n", e.dump, g.dump }
26
+ rows.each { |e,g| printf "%35s %35s\n", e.dump, g.dump }
27
27
  end
28
28
 
29
29
  assert_equal(expected, block)
@@ -385,6 +385,17 @@ class TestRDocMarkup < MiniTest::Unit::TestCase
385
385
 
386
386
  end
387
387
 
388
+ def test_list_verbatim
389
+ str = "* one\n verb1\n verb2\n* two\n"
390
+
391
+ line_groups(str,
392
+ [ "L1: ListStart\n",
393
+ "L1: BULLET ListItem\none",
394
+ "L1: Verbatim\n verb1\n verb2\n",
395
+ "L1: BULLET ListItem\ntwo",
396
+ "L1: ListEnd\n" ])
397
+ end
398
+
388
399
  def test_paragraph
389
400
  str = "paragraph\n\n*bold* paragraph\n"
390
401
 
@@ -6,6 +6,7 @@ require 'rdoc/markup/to_html'
6
6
  class TestRDocMarkupToHtml < MiniTest::Unit::TestCase
7
7
 
8
8
  def setup
9
+ @m = RDoc::Markup.new
9
10
  @am = RDoc::Markup::AttributeManager.new
10
11
  @th = RDoc::Markup::ToHtml.new
11
12
  end
@@ -23,6 +24,27 @@ class TestRDocMarkupToHtml < MiniTest::Unit::TestCase
23
24
  assert_equal 'a/c.html', gen('a.html', 'a/c.html')
24
25
  end
25
26
 
27
+ def test_list_verbatim
28
+ str = "* one\n verb1\n verb2\n* two\n"
29
+
30
+ expected = <<-EXPECTED
31
+ <ul>
32
+ <li>one
33
+
34
+ <pre>
35
+ verb1
36
+ verb2
37
+ </pre>
38
+ </li>
39
+ <li>two
40
+
41
+ </li>
42
+ </ul>
43
+ EXPECTED
44
+
45
+ assert_equal expected, @m.convert(str, @th)
46
+ end
47
+
26
48
  def test_tt_formatting
27
49
  assert_equal "<p>\n<tt>--</tt> &#8212; <tt>cats'</tt> cats&#8217;\n</p>\n",
28
50
  util_format("<tt>--</tt> -- <tt>cats'</tt> cats'")
@@ -1,77 +1,16 @@
1
1
  require 'rubygems'
2
2
  require 'minitest/unit'
3
- require 'rdoc/generator'
4
- require 'rdoc/stats'
3
+ require 'rdoc/rdoc'
5
4
  require 'rdoc/code_objects'
6
5
  require 'rdoc/markup/to_html_crossref'
7
- require 'rdoc/parser/ruby'
6
+ require 'test/xref_test_case'
8
7
 
9
- require 'pathname'
10
-
11
- class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase
12
-
13
- XREF_DATA = <<-XREF_DATA
14
- class C1
15
- def self.m
16
- end
17
-
18
- def m
19
- end
20
- end
21
-
22
- class C2
23
- class C3
24
- def m
25
- end
26
-
27
- class H1
28
- def m?
29
- end
30
- end
31
- end
32
- end
33
-
34
- class C3
35
- class H1
36
- end
37
-
38
- class H2
39
- end
40
- end
41
-
42
- class C4
43
- class C4
44
- end
45
- end
46
- XREF_DATA
8
+ class TestRDocMarkupToHtmlCrossref < XrefTestCase
47
9
 
48
10
  def setup
49
- RDoc::TopLevel.reset
50
-
51
- RDoc::Generator::Method.reset
52
- top_level = RDoc::TopLevel.new 'xref_data.rb'
53
-
54
- options = RDoc::Options.new
55
- options.quiet = true
56
- options.inline_source = true # don't build HTML files
57
-
58
- stats = RDoc::Stats.new 0
59
-
60
- parser = RDoc::Parser::Ruby.new top_level, 'xref_data.rb', XREF_DATA,
61
- options, stats
62
- top_levels = []
63
- top_levels.push parser.scan
11
+ super
64
12
 
65
- files, classes = RDoc::Generator::Context.build_indices top_levels, options
66
-
67
- @class_hash = {}
68
-
69
- classes.each do |klass|
70
- @class_hash[klass.name] = klass
71
- end
72
-
73
- @klass = @class_hash['C1']
74
- @xref = RDoc::Markup::ToHtmlCrossref.new 'index.html', @klass, true
13
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'index.html', @c1, true
75
14
  end
76
15
 
77
16
  def assert_ref(path, ref)
@@ -84,15 +23,14 @@ end
84
23
  end
85
24
 
86
25
  def test_handle_special_CROSSREF_C2
87
- @klass = @class_hash['C2']
88
- @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2.html', @klass, true
26
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2.html', @c2, true
89
27
 
90
28
  refute_ref '#m', '#m'
91
29
 
92
- assert_ref 'C2/C3.html', 'C2::C3'
93
- assert_ref 'C2/C3.html#M000003', 'C2::C3#m'
94
- assert_ref 'C2/C3/H1.html', 'C3::H1'
95
- assert_ref 'C4.html', 'C4'
30
+ assert_ref '../C2/C3.html', 'C2::C3'
31
+ assert_ref '../C2/C3.html#M000002', 'C2::C3#m'
32
+ assert_ref '../C2/C3/H1.html', 'C3::H1'
33
+ assert_ref '../C4.html', 'C4'
96
34
 
97
35
  # TODO there is a C3::H2 in the top-level namespace and RDoc should follow
98
36
  # constant scoping rules
@@ -101,100 +39,96 @@ end
101
39
  end
102
40
 
103
41
  def test_handle_special_CROSSREF_C2_C3
104
- @klass = @class_hash['C2::C3']
105
- @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2/C3.html', @klass, true
42
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2/C3.html', @c2_c3, true
106
43
 
107
- assert_ref 'C3.html#M000003', '#m'
44
+ assert_ref '../../C2/C3.html#M000002', '#m'
108
45
 
109
- assert_ref 'C3.html', 'C3'
110
- assert_ref 'C3.html#M000003', 'C3#m'
46
+ assert_ref '../../C2/C3.html', 'C3'
47
+ assert_ref '../../C2/C3.html#M000002', 'C3#m'
111
48
 
112
- assert_ref 'C3/H1.html', 'H1'
113
- assert_ref 'C3/H1.html', 'C3::H1'
49
+ assert_ref '../../C2/C3/H1.html', 'H1'
50
+ assert_ref '../../C2/C3/H1.html', 'C3::H1'
114
51
 
115
- assert_ref '../C4.html', 'C4'
52
+ assert_ref '../../C4.html', 'C4'
116
53
 
117
54
  refute_ref 'C3::H2', 'C3::H2'
118
55
  end
119
56
 
120
57
  def test_handle_special_CROSSREF_C3
121
- @klass = @class_hash['C3']
122
- @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C3.html', @klass, true
58
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C3.html', @c3, true
123
59
 
124
- assert_ref 'C3.html', 'C3'
60
+ assert_ref '../C3.html', 'C3'
125
61
 
126
62
  refute_ref '#m', '#m'
127
63
  refute_ref 'C3#m', 'C3#m'
128
64
 
129
- assert_ref 'C3/H1.html', 'H1'
65
+ assert_ref '../C3/H1.html', 'H1'
130
66
 
131
- assert_ref 'C3/H1.html', 'C3::H1'
132
- assert_ref 'C3/H2.html', 'C3::H2'
67
+ assert_ref '../C3/H1.html', 'C3::H1'
68
+ assert_ref '../C3/H2.html', 'C3::H2'
133
69
 
134
- assert_ref 'C4.html', 'C4'
70
+ assert_ref '../C4.html', 'C4'
135
71
  end
136
72
 
137
73
  def test_handle_special_CROSSREF_C4
138
- @klass = @class_hash['C4']
139
- @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C4.html', @klass, true
74
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C4.html', @c4, true
140
75
 
141
76
  # C4 ref inside a C4 containing a C4 should resolve to the contained class
142
- assert_ref 'C4/C4.html', 'C4'
77
+ assert_ref '../C4/C4.html', 'C4'
143
78
  end
144
79
 
145
80
  def test_handle_special_CROSSREF_C4_C4
146
- @klass = @class_hash['C4::C4']
147
- @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C4/C4.html', @klass, true
81
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C4/C4.html', @c4_c4, true
148
82
 
149
83
  # A C4 reference inside a C4 class contained within a C4 class should
150
84
  # resolve to the inner C4 class.
151
- assert_ref 'C4.html', 'C4'
85
+ assert_ref '../../C4/C4.html', 'C4'
152
86
  end
153
87
 
154
88
  def test_handle_special_CROSSREF_class
155
- assert_ref 'classes/C1.html', 'C1'
89
+ assert_ref 'C1.html', 'C1'
156
90
  refute_ref 'H1', 'H1'
157
91
 
158
- assert_ref 'classes/C2.html', 'C2'
159
- assert_ref 'classes/C2/C3.html', 'C2::C3'
160
- assert_ref 'classes/C2/C3/H1.html', 'C2::C3::H1'
92
+ assert_ref 'C2.html', 'C2'
93
+ assert_ref 'C2/C3.html', 'C2::C3'
94
+ assert_ref 'C2/C3/H1.html', 'C2::C3::H1'
161
95
 
162
- assert_ref 'classes/C3.html', '::C3'
163
- assert_ref 'classes/C3/H1.html', '::C3::H1'
96
+ assert_ref 'C3.html', '::C3'
97
+ assert_ref 'C3/H1.html', '::C3::H1'
164
98
 
165
- assert_ref 'classes/C4/C4.html', 'C4::C4'
99
+ assert_ref 'C4/C4.html', 'C4::C4'
166
100
  end
167
101
 
168
102
  def test_handle_special_CROSSREF_file
169
- assert_ref 'files/xref_data_rb.html', 'xref_data.rb'
103
+ assert_ref 'xref_data_rb.html', 'xref_data.rb'
170
104
  end
171
105
 
172
106
  def test_handle_special_CROSSREF_method
173
107
  refute_ref 'm', 'm'
174
- assert_ref 'classes/C1.html#M000001', '#m'
108
+ assert_ref 'C1.html#M000000', '#m'
175
109
 
176
- assert_ref 'classes/C1.html#M000001', 'C1#m'
177
- assert_ref 'classes/C1.html#M000001', 'C1#m()'
178
- assert_ref 'classes/C1.html#M000001', 'C1#m(*)'
110
+ assert_ref 'C1.html#M000000', 'C1#m'
111
+ assert_ref 'C1.html#M000000', 'C1#m()'
112
+ assert_ref 'C1.html#M000000', 'C1#m(*)'
179
113
 
180
- assert_ref 'classes/C1.html#M000001', 'C1.m'
181
- assert_ref 'classes/C1.html#M000001', 'C1.m()'
182
- assert_ref 'classes/C1.html#M000001', 'C1.m(*)'
114
+ assert_ref 'C1.html#M000000', 'C1.m'
115
+ assert_ref 'C1.html#M000000', 'C1.m()'
116
+ assert_ref 'C1.html#M000000', 'C1.m(*)'
183
117
 
184
118
  # HACK should this work
185
119
  #assert_ref 'classes/C1.html#M000001', 'C1::m'
186
120
  #assert_ref 'classes/C1.html#M000001', 'C1::m()'
187
121
  #assert_ref 'classes/C1.html#M000001', 'C1::m(*)'
188
122
 
189
- assert_ref 'classes/C2/C3.html#M000003', 'C2::C3#m'
123
+ assert_ref 'C2/C3.html#M000002', 'C2::C3#m'
190
124
 
191
- assert_ref 'classes/C2/C3.html#M000003', 'C2::C3.m'
125
+ assert_ref 'C2/C3.html#M000002', 'C2::C3.m'
192
126
 
193
- assert_ref 'classes/C2/C3/H1.html#M000004', 'C2::C3::H1#m?'
127
+ assert_ref 'C2/C3/H1.html#M000003', 'C2::C3::H1#m?'
194
128
 
195
- assert_ref 'classes/C2/C3.html#M000003', '::C2::C3#m'
196
- assert_ref 'classes/C2/C3.html#M000003', '::C2::C3#m()'
197
- assert_ref 'classes/C2/C3.html#M000003', '::C2::C3#m(*)'
129
+ assert_ref 'C2/C3.html#M000002', '::C2::C3#m'
130
+ assert_ref 'C2/C3.html#M000002', '::C2::C3#m()'
131
+ assert_ref 'C2/C3.html#M000002', '::C2::C3#m(*)'
198
132
  end
199
133
 
200
134
  def test_handle_special_CROSSREF_no_ref
@@ -216,10 +150,11 @@ end
216
150
  end
217
151
 
218
152
  def test_handle_special_CROSSREF_special
219
- assert_equal "<p>\n<a href=\"classes/C2/C3.html\">C2::C3</a>;method(*)\n</p>\n",
153
+ assert_equal "<p>\n<a href=\"C2/C3.html\">C2::C3</a>;method(*)\n</p>\n",
220
154
  @xref.convert('C2::C3;method(*)')
221
155
  end
222
156
 
223
157
  end
224
158
 
225
159
  MiniTest::Unit.autorun
160
+
@@ -0,0 +1,26 @@
1
+ require 'test/xref_test_case'
2
+
3
+ class TestRDocNormalModule < XrefTestCase
4
+
5
+ def setup
6
+ super
7
+
8
+ @mod = RDoc::NormalModule.new 'Mod'
9
+ end
10
+
11
+ def test_comment_equals
12
+ @mod.comment = '# comment 1'
13
+
14
+ assert_equal '# comment 1', @mod.comment
15
+
16
+ @mod.comment = '# comment 2'
17
+
18
+ assert_equal "# comment 1\n# ---\n# comment 2", @mod.comment
19
+ end
20
+
21
+ def test_module_eh
22
+ assert @mod.module?
23
+ end
24
+
25
+ end
26
+
@@ -298,6 +298,39 @@ Init_Foo(void) {
298
298
  assert_equal "VALUE\nother_function() ", code
299
299
  end
300
300
 
301
+ def test_find_body_define
302
+ content = <<-EOF
303
+ /*
304
+ * a comment for other_function
305
+ */
306
+ #define other_function rb_other_function
307
+
308
+ /* */
309
+ VALUE
310
+ rb_other_function() {
311
+ }
312
+
313
+ void
314
+ Init_Foo(void) {
315
+ VALUE foo = rb_define_class("Foo", rb_cObject);
316
+
317
+ rb_define_method(foo, "my_method", other_function, 0);
318
+ }
319
+ EOF
320
+
321
+ klass = util_get_class content, 'foo'
322
+ other_function = klass.method_list.first
323
+
324
+ assert_equal 'my_method', other_function.name
325
+ assert_equal " \n a comment for other_function\n \n \n",
326
+ other_function.comment
327
+ assert_equal '()', other_function.params
328
+
329
+ code = other_function.token_stream.first.text
330
+
331
+ assert_equal "#define other_function rb_other_function", code
332
+ end
333
+
301
334
  def test_define_method
302
335
  content = <<-EOF
303
336
  /*Method Comment! */
@@ -17,7 +17,7 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
17
17
  @tempfile2 = Tempfile.new self.class.name
18
18
  @filename2 = @tempfile2.path
19
19
 
20
- util_toplevel
20
+ util_top_level
21
21
  @options = RDoc::Options.new
22
22
  @options.quiet = true
23
23
  @stats = RDoc::Stats.new 0
@@ -177,13 +177,12 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
177
177
  assert_equal 'Foo', foo.full_name
178
178
  assert_equal comment, foo.comment
179
179
  end
180
-
180
+
181
181
  def test_parse_class_mistaken_for_module
182
- #
183
- # The code below is not strictly legal Ruby (Foo must have been defined
184
- # before Foo::Bar is encountered), but RDoc might encounter Foo::Bar before
185
- # Foo if they live in different files.
186
- #
182
+ # The code below is not strictly legal Ruby (Foo must have been defined
183
+ # before Foo::Bar is encountered), but RDoc might encounter Foo::Bar
184
+ # before Foo if they live in different files.
185
+
187
186
  code = <<-EOF
188
187
  class Foo::Bar
189
188
  end
@@ -193,13 +192,15 @@ end
193
192
 
194
193
  class Foo
195
194
  end
196
- EOF
195
+ EOF
197
196
 
198
197
  util_parser code
199
198
 
200
- @parser.scan()
199
+ @parser.scan
200
+
201
+ assert_equal %w[Foo::Baz], RDoc::TopLevel.modules_hash.keys
202
+ assert_empty @top_level.modules
201
203
 
202
- assert(@top_level.modules.empty?)
203
204
  foo = @top_level.classes.first
204
205
  assert_equal 'Foo', foo.full_name
205
206
 
@@ -211,24 +212,25 @@ EOF
211
212
  end
212
213
 
213
214
  def test_parse_class_definition_encountered_after_class_reference
214
- #
215
- # The code below is not strictly legal Ruby (Foo must have been defined
216
- # before Foo.bar is encountered), but RDoc might encounter Foo.bar before
217
- # Foo if they live in different files.
218
- #
215
+ # The code below is not strictly legal Ruby (Foo must have been defined
216
+ # before Foo.bar is encountered), but RDoc might encounter Foo.bar before
217
+ # Foo if they live in different files.
218
+
219
219
  code = <<-EOF
220
220
  def Foo.bar
221
221
  end
222
222
 
223
223
  class Foo < IO
224
224
  end
225
- EOF
225
+ EOF
226
226
 
227
227
  util_parser code
228
228
 
229
- @parser.scan()
229
+ @parser.scan
230
230
 
231
- assert(@top_level.modules.empty?)
231
+ assert_empty RDoc::TopLevel.modules_hash
232
+ # HACK why does it fail?
233
+ #assert_empty @top_level.modules
232
234
 
233
235
  foo = @top_level.classes.first
234
236
  assert_equal 'Foo', foo.full_name
@@ -305,7 +307,7 @@ end
305
307
  assert_equal klass.current_section, foo.section
306
308
 
307
309
  stream = [
308
- tk(:COMMENT, 1, 1, nil, "# File #{@top_level.file_absolute_name}, line 1"),
310
+ tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
309
311
  RDoc::Parser::Ruby::NEWLINE_TOKEN,
310
312
  tk(:SPACE, 1, 1, nil, ''),
311
313
  ]
@@ -347,7 +349,7 @@ end
347
349
  assert_equal klass.current_section, foo.section
348
350
 
349
351
  stream = [
350
- tk(:COMMENT, 1, 1, nil, "# File #{@top_level.file_absolute_name}, line 1"),
352
+ tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
351
353
  RDoc::Parser::Ruby::NEWLINE_TOKEN,
352
354
  tk(:SPACE, 1, 1, nil, ''),
353
355
  tk(:IDENTIFIER, 1, 0, 'add_my_method', 'add_my_method'),
@@ -430,6 +432,21 @@ end
430
432
  assert_equal comment, foo.comment
431
433
  end
432
434
 
435
+ def test_parse_meta_method_unknown
436
+ klass = RDoc::NormalClass.new 'Foo'
437
+ comment = "##\n# my method\n"
438
+
439
+ util_parser "add_my_method ('foo')"
440
+
441
+ tk = @parser.get_tk
442
+
443
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
444
+
445
+ foo = klass.method_list.first
446
+ assert_equal 'unknown', foo.name
447
+ assert_equal comment, foo.comment
448
+ end
449
+
433
450
  def test_parse_method
434
451
  klass = RDoc::NormalClass.new 'Foo'
435
452
  klass.parent = @top_level
@@ -464,7 +481,7 @@ end
464
481
  assert_equal klass.current_section, foo.section
465
482
 
466
483
  stream = [
467
- tk(:COMMENT, 1, 1, nil, "# File #{@top_level.file_absolute_name}, line 1"),
484
+ tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
468
485
  RDoc::Parser::Ruby::NEWLINE_TOKEN,
469
486
  tk(:SPACE, 1, 1, nil, ''),
470
487
  tk(:DEF, 1, 0, 'def', 'def'),
@@ -482,6 +499,21 @@ end
482
499
  assert_equal stream, foo.token_stream
483
500
  end
484
501
 
502
+ def test_parse_method_funky
503
+ klass = RDoc::NormalClass.new 'Foo'
504
+ klass.parent = @top_level
505
+
506
+ comment = "##\n# my method\n"
507
+
508
+ util_parser "def (blah).foo() :bar end"
509
+
510
+ tk = @parser.get_tk
511
+
512
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
513
+
514
+ assert klass.method_list.empty?
515
+ end
516
+
485
517
  def test_parse_statements_class_nested
486
518
  comment = "##\n# my method\n"
487
519
 
@@ -648,20 +680,6 @@ EOF
648
680
  assert_equal 'RW', foo.rw
649
681
  end
650
682
 
651
- def test_parse_statements_identifier_extra_accessors
652
- @options.extra_accessors = /^my_accessor$/
653
-
654
- content = "class Foo; my_accessor :foo; end"
655
-
656
- util_parser content
657
-
658
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
659
-
660
- foo = @top_level.classes.first.attributes.first
661
- assert_equal 'foo', foo.name
662
- assert_equal '?', foo.rw
663
- end
664
-
665
683
  def test_parse_statements_identifier_include
666
684
  content = "class Foo; include Bar; end"
667
685
 
@@ -740,7 +758,7 @@ EOF
740
758
  second_file_content, @options, @stats
741
759
  end
742
760
 
743
- def util_toplevel
761
+ def util_top_level
744
762
  RDoc::TopLevel.reset
745
763
  @top_level = RDoc::TopLevel.new @filename
746
764
  @top_level2 = RDoc::TopLevel.new @filename2