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.

Files changed (200) hide show
  1. checksums.yaml +6 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +3 -2
  5. data/DEVELOPERS.rdoc +53 -0
  6. data/History.rdoc +159 -25
  7. data/LEGAL.rdoc +12 -0
  8. data/Manifest.txt +56 -3
  9. data/README.rdoc +87 -19
  10. data/Rakefile +11 -2
  11. data/TODO.rdoc +20 -13
  12. data/bin/rdoc +4 -0
  13. data/lib/gauntlet_rdoc.rb +1 -1
  14. data/lib/rdoc.rb +32 -71
  15. data/lib/rdoc/any_method.rb +75 -21
  16. data/lib/rdoc/attr.rb +49 -10
  17. data/lib/rdoc/class_module.rb +182 -32
  18. data/lib/rdoc/code_object.rb +54 -12
  19. data/lib/rdoc/comment.rb +8 -1
  20. data/lib/rdoc/constant.rb +100 -6
  21. data/lib/rdoc/context.rb +93 -41
  22. data/lib/rdoc/context/section.rb +143 -28
  23. data/lib/rdoc/cross_reference.rb +58 -50
  24. data/lib/rdoc/encoding.rb +34 -29
  25. data/lib/rdoc/erb_partial.rb +18 -0
  26. data/lib/rdoc/extend.rb +117 -0
  27. data/lib/rdoc/generator.rb +11 -6
  28. data/lib/rdoc/generator/darkfish.rb +250 -62
  29. data/lib/rdoc/generator/json_index.rb +20 -12
  30. data/lib/rdoc/generator/markup.rb +10 -12
  31. data/lib/rdoc/generator/ri.rb +7 -60
  32. data/lib/rdoc/generator/template/darkfish/_head.rhtml +7 -7
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +16 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +1 -1
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +14 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +1 -1
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +13 -0
  38. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -1
  39. data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  40. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -3
  41. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -9
  42. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -0
  43. data/lib/rdoc/generator/template/darkfish/rdoc.css +31 -0
  44. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +18 -0
  45. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +37 -0
  46. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  47. data/lib/rdoc/include.rb +12 -3
  48. data/lib/rdoc/markdown.kpeg +1186 -0
  49. data/lib/rdoc/markdown.rb +16336 -0
  50. data/lib/rdoc/markdown/entities.rb +2128 -0
  51. data/lib/rdoc/markdown/literals_1_8.kpeg +18 -0
  52. data/lib/rdoc/markdown/literals_1_8.rb +454 -0
  53. data/lib/rdoc/markdown/literals_1_9.kpeg +22 -0
  54. data/lib/rdoc/markdown/literals_1_9.rb +417 -0
  55. data/lib/rdoc/markup.rb +69 -10
  56. data/lib/rdoc/markup/attr_changer.rb +2 -5
  57. data/lib/rdoc/markup/attribute_manager.rb +23 -14
  58. data/lib/rdoc/markup/attributes.rb +70 -0
  59. data/lib/rdoc/markup/block_quote.rb +14 -0
  60. data/lib/rdoc/markup/document.rb +20 -4
  61. data/lib/rdoc/markup/formatter.rb +17 -6
  62. data/lib/rdoc/markup/formatter_test_case.rb +93 -24
  63. data/lib/rdoc/markup/hard_break.rb +31 -0
  64. data/lib/rdoc/markup/heading.rb +1 -1
  65. data/lib/rdoc/markup/indented_paragraph.rb +14 -0
  66. data/lib/rdoc/markup/list.rb +23 -4
  67. data/lib/rdoc/markup/list_item.rb +17 -4
  68. data/lib/rdoc/markup/paragraph.rb +14 -0
  69. data/lib/rdoc/markup/parser.rb +107 -60
  70. data/lib/rdoc/markup/raw.rb +4 -4
  71. data/lib/rdoc/markup/special.rb +3 -3
  72. data/lib/rdoc/markup/to_ansi.rb +7 -1
  73. data/lib/rdoc/markup/to_html.rb +42 -14
  74. data/lib/rdoc/markup/to_html_crossref.rb +10 -9
  75. data/lib/rdoc/markup/to_html_snippet.rb +20 -4
  76. data/lib/rdoc/markup/to_joined_paragraph.rb +68 -0
  77. data/lib/rdoc/markup/to_label.rb +20 -1
  78. data/lib/rdoc/markup/to_markdown.rb +134 -0
  79. data/lib/rdoc/markup/to_rdoc.rb +36 -5
  80. data/lib/rdoc/markup/to_table_of_contents.rb +6 -1
  81. data/lib/rdoc/markup/to_tt_only.rb +11 -2
  82. data/lib/rdoc/markup/verbatim.rb +19 -0
  83. data/lib/rdoc/method_attr.rb +33 -19
  84. data/lib/rdoc/normal_class.rb +26 -7
  85. data/lib/rdoc/normal_module.rb +10 -5
  86. data/lib/rdoc/options.rb +95 -21
  87. data/lib/rdoc/parser.rb +6 -2
  88. data/lib/rdoc/parser/c.rb +212 -97
  89. data/lib/rdoc/parser/markdown.rb +23 -0
  90. data/lib/rdoc/parser/ruby.rb +115 -35
  91. data/lib/rdoc/parser/ruby_tools.rb +8 -3
  92. data/lib/rdoc/rd.rb +8 -4
  93. data/lib/rdoc/rd/block_parser.rb +1 -1
  94. data/lib/rdoc/rd/block_parser.ry +1 -1
  95. data/lib/rdoc/rdoc.rb +45 -21
  96. data/lib/rdoc/ri/driver.rb +322 -76
  97. data/lib/rdoc/ri/paths.rb +90 -31
  98. data/lib/rdoc/ri/store.rb +2 -353
  99. data/lib/rdoc/ruby_lex.rb +5 -21
  100. data/lib/rdoc/ruby_token.rb +2 -3
  101. data/lib/rdoc/rubygems_hook.rb +21 -9
  102. data/lib/rdoc/servlet.rb +302 -0
  103. data/lib/rdoc/stats.rb +28 -20
  104. data/lib/rdoc/store.rb +881 -0
  105. data/lib/rdoc/task.rb +2 -1
  106. data/lib/rdoc/test_case.rb +103 -1
  107. data/lib/rdoc/text.rb +5 -4
  108. data/lib/rdoc/tom_doc.rb +17 -16
  109. data/lib/rdoc/top_level.rb +43 -285
  110. data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +21 -0
  111. data/test/MarkdownTest_1.0.3/Auto links.text +13 -0
  112. data/test/MarkdownTest_1.0.3/Backslash escapes.text +120 -0
  113. data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +11 -0
  114. data/test/MarkdownTest_1.0.3/Code Blocks.text +14 -0
  115. data/test/MarkdownTest_1.0.3/Code Spans.text +6 -0
  116. data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +8 -0
  117. data/test/MarkdownTest_1.0.3/Horizontal rules.text +67 -0
  118. data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +15 -0
  119. data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +69 -0
  120. data/test/MarkdownTest_1.0.3/Inline HTML comments.text +13 -0
  121. data/test/MarkdownTest_1.0.3/Links, inline style.text +12 -0
  122. data/test/MarkdownTest_1.0.3/Links, reference style.text +71 -0
  123. data/test/MarkdownTest_1.0.3/Links, shortcut references.text +20 -0
  124. data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +7 -0
  125. data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +306 -0
  126. data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +888 -0
  127. data/test/MarkdownTest_1.0.3/Nested blockquotes.text +5 -0
  128. data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +131 -0
  129. data/test/MarkdownTest_1.0.3/Strong and em together.text +7 -0
  130. data/test/MarkdownTest_1.0.3/Tabs.text +21 -0
  131. data/test/MarkdownTest_1.0.3/Tidyness.text +5 -0
  132. data/test/test_attribute_manager.rb +7 -4
  133. data/test/test_rdoc_any_method.rb +84 -13
  134. data/test/test_rdoc_attr.rb +59 -9
  135. data/test/test_rdoc_class_module.rb +670 -73
  136. data/test/test_rdoc_code_object.rb +21 -1
  137. data/test/test_rdoc_comment.rb +1 -1
  138. data/test/test_rdoc_constant.rb +132 -0
  139. data/test/test_rdoc_context.rb +84 -18
  140. data/test/test_rdoc_context_section.rb +99 -15
  141. data/test/test_rdoc_cross_reference.rb +1 -1
  142. data/test/test_rdoc_encoding.rb +17 -1
  143. data/test/test_rdoc_extend.rb +94 -0
  144. data/test/test_rdoc_generator_darkfish.rb +45 -19
  145. data/test/test_rdoc_generator_json_index.rb +27 -7
  146. data/test/test_rdoc_generator_markup.rb +3 -3
  147. data/test/test_rdoc_generator_ri.rb +11 -9
  148. data/test/test_rdoc_include.rb +12 -0
  149. data/test/test_rdoc_markdown.rb +977 -0
  150. data/test/test_rdoc_markdown_test.rb +1891 -0
  151. data/test/test_rdoc_markup.rb +1 -1
  152. data/test/test_rdoc_markup_attribute_manager.rb +2 -2
  153. data/test/test_rdoc_markup_attributes.rb +39 -0
  154. data/test/test_rdoc_markup_document.rb +16 -1
  155. data/test/test_rdoc_markup_formatter.rb +7 -4
  156. data/test/test_rdoc_markup_hard_break.rb +31 -0
  157. data/test/test_rdoc_markup_indented_paragraph.rb +14 -0
  158. data/test/test_rdoc_markup_paragraph.rb +15 -1
  159. data/test/test_rdoc_markup_parser.rb +152 -89
  160. data/test/test_rdoc_markup_to_ansi.rb +23 -2
  161. data/test/test_rdoc_markup_to_bs.rb +24 -0
  162. data/test/test_rdoc_markup_to_html.rb +50 -19
  163. data/test/test_rdoc_markup_to_html_crossref.rb +23 -5
  164. data/test/test_rdoc_markup_to_html_snippet.rb +49 -8
  165. data/test/test_rdoc_markup_to_joined_paragraph.rb +32 -0
  166. data/test/test_rdoc_markup_to_label.rb +63 -1
  167. data/test/test_rdoc_markup_to_markdown.rb +352 -0
  168. data/test/test_rdoc_markup_to_rdoc.rb +22 -2
  169. data/test/test_rdoc_markup_to_table_of_contents.rb +44 -39
  170. data/test/test_rdoc_markup_to_tt_only.rb +20 -0
  171. data/test/test_rdoc_markup_verbatim.rb +13 -0
  172. data/test/test_rdoc_method_attr.rb +5 -0
  173. data/test/test_rdoc_normal_class.rb +24 -5
  174. data/test/test_rdoc_normal_module.rb +1 -1
  175. data/test/test_rdoc_options.rb +21 -6
  176. data/test/test_rdoc_parser.rb +24 -0
  177. data/test/test_rdoc_parser_c.rb +151 -26
  178. data/test/test_rdoc_parser_markdown.rb +55 -0
  179. data/test/test_rdoc_parser_rd.rb +2 -2
  180. data/test/test_rdoc_parser_ruby.rb +468 -109
  181. data/test/test_rdoc_parser_simple.rb +2 -2
  182. data/test/test_rdoc_rd_block_parser.rb +0 -4
  183. data/test/test_rdoc_rdoc.rb +110 -22
  184. data/test/test_rdoc_ri_driver.rb +415 -80
  185. data/test/test_rdoc_ri_paths.rb +122 -13
  186. data/test/test_rdoc_ruby_lex.rb +5 -61
  187. data/test/test_rdoc_ruby_token.rb +19 -0
  188. data/test/test_rdoc_rubygems_hook.rb +64 -43
  189. data/test/test_rdoc_servlet.rb +429 -0
  190. data/test/test_rdoc_stats.rb +83 -24
  191. data/test/{test_rdoc_ri_store.rb → test_rdoc_store.rb} +395 -22
  192. data/test/test_rdoc_task.rb +2 -2
  193. data/test/test_rdoc_text.rb +37 -11
  194. data/test/test_rdoc_tom_doc.rb +59 -62
  195. data/test/test_rdoc_top_level.rb +71 -113
  196. data/test/xref_test_case.rb +7 -9
  197. metadata +122 -39
  198. metadata.gz.sig +0 -0
  199. data/CVE-2013-0256.rdoc +0 -49
  200. data/lib/rdoc/markup/attribute.rb +0 -51
@@ -0,0 +1,5 @@
1
+ > foo
2
+ >
3
+ > > bar
4
+ >
5
+ > foo
@@ -0,0 +1,131 @@
1
+ ## Unordered
2
+
3
+ Asterisks tight:
4
+
5
+ * asterisk 1
6
+ * asterisk 2
7
+ * asterisk 3
8
+
9
+
10
+ Asterisks loose:
11
+
12
+ * asterisk 1
13
+
14
+ * asterisk 2
15
+
16
+ * asterisk 3
17
+
18
+ * * *
19
+
20
+ Pluses tight:
21
+
22
+ + Plus 1
23
+ + Plus 2
24
+ + Plus 3
25
+
26
+
27
+ Pluses loose:
28
+
29
+ + Plus 1
30
+
31
+ + Plus 2
32
+
33
+ + Plus 3
34
+
35
+ * * *
36
+
37
+
38
+ Minuses tight:
39
+
40
+ - Minus 1
41
+ - Minus 2
42
+ - Minus 3
43
+
44
+
45
+ Minuses loose:
46
+
47
+ - Minus 1
48
+
49
+ - Minus 2
50
+
51
+ - Minus 3
52
+
53
+
54
+ ## Ordered
55
+
56
+ Tight:
57
+
58
+ 1. First
59
+ 2. Second
60
+ 3. Third
61
+
62
+ and:
63
+
64
+ 1. One
65
+ 2. Two
66
+ 3. Three
67
+
68
+
69
+ Loose using tabs:
70
+
71
+ 1. First
72
+
73
+ 2. Second
74
+
75
+ 3. Third
76
+
77
+ and using spaces:
78
+
79
+ 1. One
80
+
81
+ 2. Two
82
+
83
+ 3. Three
84
+
85
+ Multiple paragraphs:
86
+
87
+ 1. Item 1, graf one.
88
+
89
+ Item 2. graf two. The quick brown fox jumped over the lazy dog's
90
+ back.
91
+
92
+ 2. Item 2.
93
+
94
+ 3. Item 3.
95
+
96
+
97
+
98
+ ## Nested
99
+
100
+ * Tab
101
+ * Tab
102
+ * Tab
103
+
104
+ Here's another:
105
+
106
+ 1. First
107
+ 2. Second:
108
+ * Fee
109
+ * Fie
110
+ * Foe
111
+ 3. Third
112
+
113
+ Same thing but with paragraphs:
114
+
115
+ 1. First
116
+
117
+ 2. Second:
118
+ * Fee
119
+ * Fie
120
+ * Foe
121
+
122
+ 3. Third
123
+
124
+
125
+ This was an error in Markdown 1.0.1:
126
+
127
+ * this
128
+
129
+ * sub
130
+
131
+ that
@@ -0,0 +1,7 @@
1
+ ***This is strong and em.***
2
+
3
+ So is ***this*** word.
4
+
5
+ ___This is strong and em.___
6
+
7
+ So is ___this___ word.
@@ -0,0 +1,21 @@
1
+ + this is a list item
2
+ indented with tabs
3
+
4
+ + this is a list item
5
+ indented with spaces
6
+
7
+ Code:
8
+
9
+ this code block is indented by one tab
10
+
11
+ And:
12
+
13
+ this code block is indented by two tabs
14
+
15
+ And:
16
+
17
+ + this is an example list item
18
+ indented with tabs
19
+
20
+ + this is an example list item
21
+ indented with spaces
@@ -0,0 +1,5 @@
1
+ > A list within a blockquote:
2
+ >
3
+ > * asterisk 1
4
+ > * asterisk 2
5
+ > * asterisk 3
@@ -5,9 +5,11 @@ class TestAttributeManager < RDoc::TestCase # HACK fix test name
5
5
  def setup
6
6
  super
7
7
 
8
+ @options = RDoc::Options.new
9
+
8
10
  @am = RDoc::Markup::AttributeManager.new
9
11
  @klass = RDoc::Markup::AttributeManager
10
- @formatter = RDoc::Markup::Formatter.new
12
+ @formatter = RDoc::Markup::Formatter.new @options
11
13
  @formatter.add_tag :BOLD, '<B>', '</B>'
12
14
  @formatter.add_tag :EM, '<EM>', '</EM>'
13
15
  @formatter.add_tag :TT, '<CODE>', '</CODE>'
@@ -70,10 +72,11 @@ class TestAttributeManager < RDoc::TestCase # HACK fix test name
70
72
  end
71
73
 
72
74
  def test_add_special
73
- @am.add_special("WikiWord", :WIKIWORD)
75
+ @am.add_special "WikiWord", :WIKIWORD
74
76
  specials = @am.special
75
- assert_equal(1,specials.size)
76
- assert(specials.has_key?("WikiWord"))
77
+
78
+ assert_equal 1, specials.size
79
+ assert specials.assoc "WikiWord"
77
80
  end
78
81
 
79
82
  def test_escapes
@@ -60,7 +60,9 @@ method(a, b) { |c, d| ... }
60
60
  end
61
61
 
62
62
  def test_marshal_dump
63
- top_level = RDoc::TopLevel.new 'file.rb'
63
+ @store.path = Dir.tmpdir
64
+ top_level = @store.add_file 'file.rb'
65
+
64
66
  m = RDoc::AnyMethod.new nil, 'method'
65
67
  m.block_params = 'some_block'
66
68
  m.call_seq = 'call_seq'
@@ -68,20 +70,23 @@ method(a, b) { |c, d| ... }
68
70
  m.params = 'param'
69
71
  m.record_location top_level
70
72
 
71
- cm = RDoc::ClassModule.new 'Klass'
73
+ cm = top_level.add_class RDoc::ClassModule, 'Klass'
72
74
  cm.add_method m
73
75
 
76
+ section = cm.sections.first
77
+
74
78
  al = RDoc::Alias.new nil, 'method', 'aliased', 'alias comment'
75
79
  al_m = m.add_alias al, cm
76
80
 
77
81
  loaded = Marshal.load Marshal.dump m
82
+ loaded.store = @store
78
83
 
79
84
  comment = RDoc::Markup::Document.new(
80
85
  RDoc::Markup::Paragraph.new('this is a comment'))
81
86
 
82
87
  assert_equal m, loaded
83
88
 
84
- assert_equal [al_m], loaded.aliases
89
+ assert_equal [al_m.name], loaded.aliases.map { |alas| alas.name }
85
90
  assert_equal 'some_block', loaded.block_params
86
91
  assert_equal 'call_seq', loaded.call_seq
87
92
  assert_equal comment, loaded.comment
@@ -91,6 +96,8 @@ method(a, b) { |c, d| ... }
91
96
  assert_equal 'param', loaded.params
92
97
  assert_equal nil, loaded.singleton # defaults to nil
93
98
  assert_equal :public, loaded.visibility
99
+ assert_equal cm, loaded.parent
100
+ assert_equal section, loaded.section
94
101
  end
95
102
 
96
103
  def test_marshal_load
@@ -114,28 +121,37 @@ method(a, b) { |c, d| ... }
114
121
  end
115
122
 
116
123
  def test_marshal_load_version_0
124
+ @store.path = Dir.tmpdir
125
+ top_level = @store.add_file 'file.rb'
126
+
117
127
  m = RDoc::AnyMethod.new nil, 'method'
118
- cm = RDoc::ClassModule.new 'Klass'
128
+
129
+ cm = top_level.add_class RDoc::ClassModule, 'Klass'
119
130
  cm.add_method m
131
+
132
+ section = cm.sections.first
133
+
120
134
  al = RDoc::Alias.new nil, 'method', 'aliased', 'alias comment'
121
135
  al_m = m.add_alias al, cm
122
136
 
123
- loaded = Marshal.load "\x04\bU:\x14RDoc::AnyMethod[\x0Fi\x00I" \
124
- "\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" \
125
- "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" \
126
- "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" \
127
- "\"\x16this is a comment\x06;\x06FI" \
128
- "\"\rcall_seq\x06;\x06FI\"\x0Fsome_block\x06;\x06F" \
129
- "[\x06[\aI\"\faliased\x06;\x06Fo;\b\x06;\t[\x06" \
130
- "o;\n\x06;\t[\x06I\"\x12alias comment\x06;\x06FI" \
137
+ loaded = Marshal.load "\x04\bU:\x14RDoc::AnyMethod[\x0Fi\x00I" +
138
+ "\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" +
139
+ "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
140
+ "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" +
141
+ "\"\x16this is a comment\x06;\x06FI" +
142
+ "\"\rcall_seq\x06;\x06FI\"\x0Fsome_block\x06;\x06F" +
143
+ "[\x06[\aI\"\faliased\x06;\x06Fo;\b\x06;\t[\x06" +
144
+ "o;\n\x06;\t[\x06I\"\x12alias comment\x06;\x06FI" +
131
145
  "\"\nparam\x06;\x06F"
132
146
 
147
+ loaded.store = @store
148
+
133
149
  comment = RDoc::Markup::Document.new(
134
150
  RDoc::Markup::Paragraph.new('this is a comment'))
135
151
 
136
152
  assert_equal m, loaded
137
153
 
138
- assert_equal [al_m], loaded.aliases
154
+ assert_equal [al_m.name], loaded.aliases.map { |alas| alas.name }
139
155
  assert_equal 'some_block', loaded.block_params
140
156
  assert_equal 'call_seq', loaded.call_seq
141
157
  assert_equal comment, loaded.comment
@@ -145,6 +161,8 @@ method(a, b) { |c, d| ... }
145
161
  assert_equal nil, loaded.singleton # defaults to nil
146
162
  assert_equal :public, loaded.visibility
147
163
  assert_equal nil, loaded.file
164
+ assert_equal cm, loaded.parent
165
+ assert_equal section, loaded.section
148
166
  end
149
167
 
150
168
  def test_name
@@ -244,5 +262,58 @@ method(a, b) { |c, d| ... }
244
262
  assert_equal 'C1', @c1.method_list.last.parent_name
245
263
  end
246
264
 
265
+ def test_store_equals
266
+ loaded = Marshal.load Marshal.dump(@c1.method_list.last)
267
+
268
+ loaded.store = @store
269
+
270
+ assert_equal @store, loaded.file.store
271
+ end
272
+
273
+ def test_superclass_method
274
+ m3 = RDoc::AnyMethod.new '', 'no_super'
275
+
276
+ m2 = RDoc::AnyMethod.new '', 'supers'
277
+ m2.calls_super = true
278
+
279
+ m1 = RDoc::AnyMethod.new '', 'supers'
280
+
281
+ c1 = RDoc::NormalClass.new 'Outer'
282
+ c1.store = @store
283
+ c1.add_method m1
284
+
285
+ c2 = RDoc::NormalClass.new 'Inner', c1
286
+ c2.store = @store
287
+ c2.add_method m2
288
+ c2.add_method m3
289
+
290
+ assert_nil m3.superclass_method,
291
+ 'no superclass method for no_super'
292
+
293
+ assert_equal m1, m2.superclass_method,
294
+ 'superclass method missing for supers'
295
+ end
296
+
297
+ def test_superclass_method_multilevel
298
+ m2 = RDoc::AnyMethod.new '', 'supers'
299
+ m2.calls_super = true
300
+
301
+ m1 = RDoc::AnyMethod.new '', 'supers'
302
+
303
+ c1 = RDoc::NormalClass.new 'Outer'
304
+ c1.store = @store
305
+ c1.add_method m1
306
+
307
+ c2 = RDoc::NormalClass.new 'Middle', c1
308
+ c2.store = @store
309
+
310
+ c3 = RDoc::NormalClass.new 'Inner', c2
311
+ c3.store = @store
312
+ c3.add_method m2
313
+
314
+ assert_equal m1, m2.superclass_method,
315
+ 'superclass method missing for supers'
316
+ end
317
+
247
318
  end
248
319
 
@@ -43,15 +43,18 @@ class TestRDocAttr < RDoc::TestCase
43
43
  end
44
44
 
45
45
  def test_marshal_dump
46
- tl = RDoc::TopLevel.new 'file.rb'
46
+ tl = @store.add_file 'file.rb'
47
47
 
48
48
  @a.comment = 'this is a comment'
49
49
  @a.record_location tl
50
50
 
51
- cm = RDoc::ClassModule.new 'Klass'
51
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
52
52
  cm.add_attribute @a
53
53
 
54
+ section = cm.sections.first
55
+
54
56
  loaded = Marshal.load Marshal.dump @a
57
+ loaded.store = @store
55
58
 
56
59
  assert_equal @a, loaded
57
60
 
@@ -65,22 +68,28 @@ class TestRDocAttr < RDoc::TestCase
65
68
  assert_equal 'RW', loaded.rw
66
69
  assert_equal false, loaded.singleton
67
70
  assert_equal :public, loaded.visibility
71
+ assert_equal tl, loaded.file
72
+ assert_equal cm, loaded.parent
73
+ assert_equal section, loaded.section
68
74
  end
69
75
 
70
76
  def test_marshal_dump_singleton
71
- tl = RDoc::TopLevel.new 'file.rb'
77
+ tl = @store.add_file 'file.rb'
72
78
 
73
79
  @a.comment = 'this is a comment'
74
80
  @a.record_location tl
75
81
 
76
- cm = RDoc::ClassModule.new 'Klass'
82
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
77
83
  cm.add_attribute @a
78
84
 
85
+ section = cm.sections.first
86
+
79
87
  @a.rw = 'R'
80
88
  @a.singleton = true
81
89
  @a.visibility = :protected
82
90
 
83
91
  loaded = Marshal.load Marshal.dump @a
92
+ loaded.store = @store
84
93
 
85
94
  assert_equal @a, loaded
86
95
 
@@ -93,16 +102,24 @@ class TestRDocAttr < RDoc::TestCase
93
102
  assert_equal 'R', loaded.rw
94
103
  assert_equal true, loaded.singleton
95
104
  assert_equal :protected, loaded.visibility
105
+ assert_equal tl, loaded.file
106
+ assert_equal cm, loaded.parent
107
+ assert_equal section, loaded.section
96
108
  end
97
109
 
98
110
  def test_marshal_load_version_1
99
- data = "\x04\bU:\x0FRDoc::Attr[\fi\x06I\"\tattr\x06:\x06EF" \
100
- "\"\x0FKlass#attrI\"\aRW\x06;\x06F:\vpublic" \
101
- "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" \
102
- "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" \
111
+ tl = @store.add_file 'file.rb'
112
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
113
+ section = cm.sections.first
114
+
115
+ data = "\x04\bU:\x0FRDoc::Attr[\fi\x06I\"\tattr\x06:\x06EF" +
116
+ "\"\x0FKlass#attrI\"\aRW\x06;\x06F:\vpublic" +
117
+ "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
118
+ "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" +
103
119
  "\"\x16this is a comment\x06;\x06FF"
104
120
 
105
121
  loaded = Marshal.load data
122
+ loaded.store = @store
106
123
 
107
124
  comment = RDoc::Markup::Document.new(
108
125
  RDoc::Markup::Paragraph.new('this is a comment'))
@@ -114,7 +131,40 @@ class TestRDocAttr < RDoc::TestCase
114
131
  assert_equal false, loaded.singleton
115
132
  assert_equal :public, loaded.visibility
116
133
 
117
- assert_equal nil, loaded.file # version 2
134
+ # version 2
135
+ assert_nil loaded.file
136
+
137
+ # version 3
138
+ assert_equal cm, loaded.parent
139
+ assert_equal section, loaded.section
140
+ end
141
+
142
+ def test_marshal_load_version_2
143
+ tl = @store.add_file 'file.rb'
144
+ cm = tl.add_class RDoc::NormalClass, 'Klass'
145
+ section = cm.sections.first
146
+
147
+ loaded = Marshal.load "\x04\bU:\x0FRDoc::Attr[\ri\aI\"\tattr\x06" +
148
+ ":\x06ETI\"\x0FKlass#attr\x06;\x06TI\"\aRW\x06" +
149
+ ";\x06T:\vpublico:\eRDoc::Markup::Document\a" +
150
+ ":\v@parts[\x06o:\x1CRDoc::Markup::Paragraph\x06;" +
151
+ "\t[\x06I\"\x16this is a comment\x06;\x06T:\n" +
152
+ "@file0FI\"\ffile.rb\x06;\x06T"
153
+ loaded.store = @store
154
+
155
+ comment = doc(para('this is a comment'))
156
+
157
+ assert_equal comment, loaded.comment
158
+ assert_equal 'Klass#attr', loaded.full_name
159
+ assert_equal 'attr', loaded.name
160
+ assert_equal 'RW', loaded.rw
161
+ assert_equal false, loaded.singleton
162
+ assert_equal :public, loaded.visibility
163
+ assert_equal tl, loaded.file
164
+
165
+ # version 3
166
+ assert_equal cm, loaded.parent
167
+ assert_equal section, loaded.section
118
168
  end
119
169
 
120
170
  def test_params