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
@@ -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,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
|
@@ -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
|
75
|
+
@am.add_special "WikiWord", :WIKIWORD
|
74
76
|
specials = @am.special
|
75
|
-
|
76
|
-
|
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
|
-
|
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
|
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],
|
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
|
-
|
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],
|
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
|
|
data/test/test_rdoc_attr.rb
CHANGED
@@ -43,15 +43,18 @@ class TestRDocAttr < RDoc::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_marshal_dump
|
46
|
-
tl =
|
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::
|
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 =
|
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::
|
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
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
-
|
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
|