rdoc 3.9.5 → 3.10.pre.1

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 (183) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +6 -3
  3. data/History.txt +63 -13
  4. data/LICENSE.rdoc +57 -0
  5. data/Manifest.txt +60 -6
  6. data/Rakefile +24 -12
  7. data/TODO.rdoc +30 -0
  8. data/bin/rdoc +0 -2
  9. data/lib/rdoc.rb +55 -2
  10. data/lib/rdoc/alias.rb +0 -2
  11. data/lib/rdoc/anon_class.rb +0 -2
  12. data/lib/rdoc/any_method.rb +0 -3
  13. data/lib/rdoc/attr.rb +0 -2
  14. data/lib/rdoc/class_module.rb +40 -7
  15. data/lib/rdoc/code_object.rb +1 -3
  16. data/lib/rdoc/code_objects.rb +3 -21
  17. data/lib/rdoc/comment.rb +225 -0
  18. data/lib/rdoc/constant.rb +0 -2
  19. data/lib/rdoc/context.rb +37 -120
  20. data/lib/rdoc/context/section.rb +114 -0
  21. data/lib/rdoc/cross_reference.rb +16 -7
  22. data/lib/rdoc/encoding.rb +0 -2
  23. data/lib/rdoc/gauntlet.rb +1 -1
  24. data/lib/rdoc/generator.rb +7 -2
  25. data/lib/rdoc/generator/darkfish.rb +126 -20
  26. data/lib/rdoc/generator/json_index.rb +240 -0
  27. data/lib/rdoc/generator/markup.rb +17 -54
  28. data/lib/rdoc/generator/ri.rb +0 -3
  29. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  30. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -0
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +18 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +9 -0
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +8 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +16 -0
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +12 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +7 -0
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +12 -0
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +10 -0
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +10 -0
  40. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +10 -0
  41. data/lib/rdoc/generator/template/darkfish/class.rhtml +161 -0
  42. data/lib/rdoc/generator/template/darkfish/fileinfo.rhtml +32 -0
  43. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  44. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/index.rhtml +16 -61
  48. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +99 -64
  49. data/lib/rdoc/generator/template/darkfish/js/jquery.js +15 -29
  50. data/lib/rdoc/generator/template/darkfish/js/search.js +94 -0
  51. data/lib/rdoc/generator/template/darkfish/page.rhtml +16 -0
  52. data/lib/rdoc/generator/template/darkfish/rdoc.css +126 -286
  53. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +50 -0
  54. data/lib/rdoc/generator/template/json_index/js/navigation.js +142 -0
  55. data/lib/rdoc/generator/template/json_index/js/searcher.js +228 -0
  56. data/lib/rdoc/ghost_method.rb +0 -2
  57. data/lib/rdoc/include.rb +0 -2
  58. data/lib/rdoc/markup.rb +204 -43
  59. data/lib/rdoc/markup/attr_changer.rb +25 -0
  60. data/lib/rdoc/markup/attr_span.rb +29 -0
  61. data/lib/rdoc/markup/attribute.rb +51 -0
  62. data/lib/rdoc/markup/document.rb +22 -1
  63. data/lib/rdoc/markup/formatter.rb +4 -11
  64. data/lib/rdoc/markup/formatter_test_case.rb +1 -2
  65. data/lib/rdoc/markup/heading.rb +44 -0
  66. data/lib/rdoc/markup/include.rb +42 -0
  67. data/lib/rdoc/markup/inline.rb +1 -144
  68. data/lib/rdoc/markup/list.rb +2 -1
  69. data/lib/rdoc/markup/parser.rb +6 -16
  70. data/lib/rdoc/markup/pre_process.rb +64 -10
  71. data/lib/rdoc/markup/raw.rb +1 -1
  72. data/lib/rdoc/markup/special.rb +40 -0
  73. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -2
  74. data/lib/rdoc/markup/to_ansi.rb +0 -2
  75. data/lib/rdoc/markup/to_bs.rb +0 -2
  76. data/lib/rdoc/markup/to_html.rb +102 -34
  77. data/lib/rdoc/markup/to_html_crossref.rb +36 -5
  78. data/lib/rdoc/markup/to_html_snippet.rb +270 -0
  79. data/lib/rdoc/markup/to_label.rb +55 -0
  80. data/lib/rdoc/markup/to_rdoc.rb +0 -3
  81. data/lib/rdoc/markup/to_table_of_contents.rb +62 -0
  82. data/lib/rdoc/markup/to_test.rb +0 -3
  83. data/lib/rdoc/markup/to_tt_only.rb +0 -3
  84. data/lib/rdoc/markup/verbatim.rb +18 -0
  85. data/lib/rdoc/meta_method.rb +0 -2
  86. data/lib/rdoc/method_attr.rb +17 -1
  87. data/lib/rdoc/normal_class.rb +0 -2
  88. data/lib/rdoc/normal_module.rb +0 -2
  89. data/lib/rdoc/options.rb +18 -3
  90. data/lib/rdoc/parser.rb +74 -42
  91. data/lib/rdoc/parser/c.rb +79 -118
  92. data/lib/rdoc/parser/rd.rb +22 -0
  93. data/lib/rdoc/parser/ruby.rb +86 -54
  94. data/lib/rdoc/parser/simple.rb +21 -9
  95. data/lib/rdoc/parser/text.rb +11 -0
  96. data/lib/rdoc/rd.rb +95 -0
  97. data/lib/rdoc/rd/block_parser.ry +638 -0
  98. data/lib/rdoc/rd/inline.rb +71 -0
  99. data/lib/rdoc/rd/inline_parser.ry +575 -0
  100. data/lib/rdoc/rdoc.rb +8 -23
  101. data/lib/rdoc/require.rb +0 -2
  102. data/lib/rdoc/ri.rb +4 -2
  103. data/lib/rdoc/ri/driver.rb +2 -6
  104. data/lib/rdoc/ri/store.rb +0 -1
  105. data/lib/rdoc/ruby_lex.rb +43 -20
  106. data/lib/rdoc/ruby_token.rb +44 -2
  107. data/lib/rdoc/single_class.rb +0 -2
  108. data/lib/rdoc/stats.rb +0 -5
  109. data/lib/rdoc/task.rb +2 -6
  110. data/lib/rdoc/test_case.rb +59 -0
  111. data/lib/rdoc/text.rb +42 -30
  112. data/lib/rdoc/token_stream.rb +45 -0
  113. data/lib/rdoc/tom_doc.rb +232 -0
  114. data/lib/rdoc/top_level.rb +36 -4
  115. data/test/test_attribute_manager.rb +26 -29
  116. data/test/test_rdoc_any_method.rb +2 -26
  117. data/test/test_rdoc_attr.rb +4 -4
  118. data/test/test_rdoc_class_module.rb +95 -12
  119. data/test/test_rdoc_code_object.rb +10 -3
  120. data/test/test_rdoc_comment.rb +504 -0
  121. data/test/test_rdoc_context.rb +60 -11
  122. data/test/test_rdoc_context_section.rb +16 -17
  123. data/test/test_rdoc_cross_reference.rb +17 -2
  124. data/test/test_rdoc_encoding.rb +4 -7
  125. data/test/test_rdoc_generator_darkfish.rb +12 -11
  126. data/test/test_rdoc_generator_json_index.rb +255 -0
  127. data/test/test_rdoc_generator_markup.rb +56 -0
  128. data/test/test_rdoc_generator_ri.rb +8 -11
  129. data/test/test_rdoc_markup.rb +9 -5
  130. data/test/test_rdoc_markup_attribute_manager.rb +5 -8
  131. data/test/test_rdoc_markup_document.rb +34 -6
  132. data/test/test_rdoc_markup_formatter.rb +11 -13
  133. data/test/test_rdoc_markup_heading.rb +20 -0
  134. data/test/test_rdoc_markup_include.rb +19 -0
  135. data/test/test_rdoc_markup_indented_paragraph.rb +4 -5
  136. data/test/test_rdoc_markup_paragraph.rb +2 -5
  137. data/test/test_rdoc_markup_parser.rb +87 -7
  138. data/test/test_rdoc_markup_pre_process.rb +60 -9
  139. data/test/test_rdoc_markup_raw.rb +4 -6
  140. data/test/test_rdoc_markup_to_ansi.rb +1 -4
  141. data/test/test_rdoc_markup_to_bs.rb +1 -4
  142. data/test/test_rdoc_markup_to_html.rb +170 -31
  143. data/test/test_rdoc_markup_to_html_crossref.rb +89 -11
  144. data/test/test_rdoc_markup_to_html_snippet.rb +668 -0
  145. data/test/test_rdoc_markup_to_label.rb +50 -0
  146. data/test/test_rdoc_markup_to_rdoc.rb +1 -4
  147. data/test/test_rdoc_markup_to_table_of_contents.rb +90 -0
  148. data/test/test_rdoc_markup_to_tt_only.rb +1 -4
  149. data/test/test_rdoc_markup_verbatim.rb +16 -0
  150. data/test/test_rdoc_method_attr.rb +16 -1
  151. data/test/test_rdoc_options.rb +17 -7
  152. data/test/test_rdoc_parser.rb +75 -6
  153. data/test/test_rdoc_parser_c.rb +56 -104
  154. data/test/test_rdoc_parser_rd.rb +52 -0
  155. data/test/test_rdoc_parser_ruby.rb +264 -323
  156. data/test/test_rdoc_parser_simple.rb +33 -17
  157. data/test/test_rdoc_rd.rb +30 -0
  158. data/test/test_rdoc_rd_block_parser.rb +527 -0
  159. data/test/test_rdoc_rd_inline.rb +63 -0
  160. data/test/test_rdoc_rd_inline_parser.rb +173 -0
  161. data/test/test_rdoc_rdoc.rb +7 -9
  162. data/test/test_rdoc_ri_driver.rb +10 -15
  163. data/test/test_rdoc_ri_paths.rb +6 -6
  164. data/test/test_rdoc_ri_store.rb +6 -13
  165. data/test/test_rdoc_ruby_lex.rb +53 -5
  166. data/test/test_rdoc_rubygems_hook.rb +2 -1
  167. data/test/test_rdoc_stats.rb +83 -103
  168. data/test/test_rdoc_task.rb +5 -4
  169. data/test/test_rdoc_text.rb +156 -11
  170. data/test/test_rdoc_token_stream.rb +42 -0
  171. data/test/test_rdoc_tom_doc.rb +458 -0
  172. data/test/test_rdoc_top_level.rb +49 -2
  173. data/test/xref_test_case.rb +4 -8
  174. metadata +217 -111
  175. metadata.gz.sig +0 -0
  176. checksums.yaml +0 -7
  177. checksums.yaml.gz.sig +0 -0
  178. data/CVE-2013-0256.rdoc +0 -49
  179. data/LICENSE.txt +0 -57
  180. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -321
  181. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -124
  182. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
  183. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
@@ -0,0 +1,63 @@
1
+ require 'rdoc/test_case'
2
+
3
+ class TestRDocRdInline < RDoc::TestCase
4
+
5
+ def setup
6
+ super
7
+
8
+ @inline = RDoc::RD::Inline.new '+text+', 'text'
9
+ end
10
+
11
+ def test_class_new
12
+ inline = RDoc::RD::Inline.new @inline
13
+
14
+ refute_equal inline.rdoc, inline.reference
15
+ end
16
+
17
+ def test_initialize
18
+ inline = RDoc::RD::Inline.new 'text'
19
+
20
+ assert_equal inline.rdoc, inline.reference
21
+ refute_same inline.rdoc, inline.reference
22
+ end
23
+
24
+ def test_initialize_inline
25
+ inline = RDoc::RD::Inline.new @inline
26
+
27
+ assert_equal '+text+', inline.rdoc
28
+ assert_equal 'text', inline.reference
29
+ end
30
+
31
+ def test_append_inline
32
+ out = @inline.append @inline
33
+
34
+ assert_same @inline, out
35
+
36
+ assert_equal '+text++text+', @inline.rdoc
37
+ assert_equal 'texttext', @inline.reference
38
+ end
39
+
40
+ def test_append_string
41
+ @inline.append ' more'
42
+
43
+ assert_equal '+text+ more', @inline.rdoc
44
+ assert_equal 'text more', @inline.reference
45
+ end
46
+
47
+ def test_equals2
48
+ assert_equal @inline, RDoc::RD::Inline.new('+text+', 'text')
49
+ refute_equal @inline, RDoc::RD::Inline.new('+text+', 'other')
50
+ refute_equal @inline, RDoc::RD::Inline.new('+other+', 'text')
51
+ refute_equal @inline, Object.new
52
+ end
53
+
54
+ def test_inspect
55
+ assert_equal '(inline: +text+)', @inline.inspect
56
+ end
57
+
58
+ def test_to_s
59
+ assert_equal '+text+', @inline.to_s
60
+ end
61
+
62
+ end
63
+
@@ -0,0 +1,173 @@
1
+ require 'rdoc/test_case'
2
+
3
+ class TestRDocRdInlineParser < RDoc::TestCase
4
+
5
+ def setup
6
+ super
7
+
8
+ @block_parser = RDoc::RD::BlockParser.new
9
+ @block_parser.instance_variable_set :@i, 0
10
+ @inline_parser = RDoc::RD::InlineParser.new @block_parser
11
+ end
12
+
13
+ def test_parse
14
+ assert_equal 'regular <em>emphasis</em>', parse('regular ((*emphasis*))')
15
+ end
16
+
17
+ def test_parse_code
18
+ assert_equal '<code>text</code>', parse('(({text}))')
19
+ end
20
+
21
+ def test_parse_em
22
+ assert_equal '<em>text</em>', parse('((*text*))')
23
+ end
24
+
25
+ def test_parse_footnote
26
+ assert_equal '{*1}[rdoc-label:foottext-1:footmark-1]', parse('((-text-))')
27
+
28
+ expected = [
29
+ @RM::Paragraph.new('{^1}[rdoc-label:footmark-1:foottext-1]', 'text')
30
+ ]
31
+
32
+ assert_equal expected, @block_parser.footnotes
33
+ end
34
+
35
+ def test_parse_index
36
+ assert_equal '<span id="label-text">text</span>', parse('((:text:))')
37
+
38
+ assert_includes @block_parser.labels, 'text'
39
+ end
40
+
41
+ def test_parse_kbd
42
+ assert_equal '<tt>text</tt>', parse('((%text%))')
43
+ end
44
+
45
+ def test_parse_multiple
46
+ assert_equal '<em>one</em> <em>two</em>', parse('((*one*)) ((*two*))')
47
+ end
48
+
49
+ def test_parse_newline
50
+ assert_equal "one\ntwo", parse("one\ntwo")
51
+ end
52
+
53
+ def test_parse_quote
54
+ assert_equal 'one " two', parse('one " two')
55
+ end
56
+
57
+ def test_parse_ref
58
+ assert_equal '{text}[rdoc-label:text]', parse('((<text>))')
59
+ end
60
+
61
+ def test_parse_ref_em
62
+ assert_equal '{<em>text</em>}[rdoc-label:text]', parse('((<((*text*))>))')
63
+ end
64
+
65
+ def test_parse_ref_filename_quote
66
+ assert_equal '{RD/foo}[rdoc-label:RD/foo]', parse('((<RD/"foo">))')
67
+ end
68
+
69
+ def test_parse_ref_filename
70
+ assert_equal '{RD}[rdoc-label:RD/]', parse('((<RD/>))')
71
+ end
72
+
73
+ def test_parse_ref_quote
74
+ assert_equal '{text \\"}[rdoc-label:text \\"]', parse('((<text \">))')
75
+ end
76
+
77
+ def test_parse_ref_quote_content
78
+ assert_equal '{<em>text</em>}[rdoc-label:text]',
79
+ parse('((<"((*text*))">))')
80
+ end
81
+
82
+ def test_parse_ref_quote_content_multi
83
+ assert_equal '{<em>one</em> <em>two</em>}[rdoc-label:one two]',
84
+ parse('((<"((*one*)) ((*two*))">))')
85
+ end
86
+
87
+ def test_parse_ref_substitute
88
+ assert_equal '{text}[rdoc-label:thing]', parse('((<text|thing>))')
89
+ end
90
+
91
+ def test_parse_ref_substitute_element_quote
92
+ assert_equal '{text}[rdoc-label:"RD"]',
93
+ parse('((<text|"RD">))')
94
+ end
95
+
96
+ def test_parse_ref_substitute_filename
97
+ assert_equal '{text}[rdoc-label:RD/]', parse('((<text|RD/>))')
98
+ end
99
+
100
+ def test_parse_ref_substitute_filename_label
101
+ assert_equal '{text}[rdoc-label:RD/label]',
102
+ parse('((<text|RD/label>))')
103
+ end
104
+
105
+ def test_parse_ref_substitute_filename_quote
106
+ assert_equal '{text}[rdoc-label:"RD"/]', parse('((<text|"RD"/>))')
107
+ end
108
+
109
+ def test_parse_ref_substitute_multi_content
110
+ assert_equal '{<em>one</em> two}[rdoc-label:thing]',
111
+ parse('((<((*one*)) two|thing>))')
112
+ end
113
+
114
+ def test_parse_ref_substitute_multi_content2
115
+ assert_equal '{<em>one</em> \\" two}[rdoc-label:thing]',
116
+ parse('((<((*one*)) \" two|thing>))')
117
+ end
118
+
119
+ def test_parse_ref_substitute_multi_content3
120
+ assert_equal '{<em>one</em> \\" <em>two</em>}[rdoc-label:thing]',
121
+ parse('((<((*one*)) \" ((*two*))|thing>))')
122
+ end
123
+
124
+ def test_parse_ref_substitute_quote
125
+ assert_equal '{one | two}[rdoc-label:thing]',
126
+ parse('((<"one | two"|thing>))')
127
+ end
128
+
129
+ def test_parse_ref_substitute_quote_content
130
+ assert_equal '{<em>text</em>}[rdoc-label:thing]',
131
+ parse('((<"((*text*))"|thing>))')
132
+ end
133
+
134
+ def test_parse_ref_substitute_url
135
+ assert_equal '{text}[http://example]',
136
+ parse('((<text|URL:http://example>))')
137
+ end
138
+
139
+ def test_parse_ref_url
140
+ assert_equal '{http://example}[http://example]',
141
+ parse('((<URL:http://example>))')
142
+ end
143
+
144
+ def test_parse_var
145
+ assert_equal '+text+', parse('((|text|))')
146
+ end
147
+
148
+ def test_parse_verb
149
+ assert_equal '<tt>text</tt>', parse("(('text'))")
150
+ end
151
+
152
+ def test_parse_verb_backslash
153
+ assert_equal "<tt>(('text'))</tt>", parse("(('(('text\\'))'))")
154
+ end
155
+
156
+ def test_parse_verb_backslash_backslash
157
+ assert_equal '<tt>text \\</tt>', parse("(('text \\\\'))")
158
+ end
159
+
160
+ def test_parse_verb_backslash_quote
161
+ assert_equal '<tt>text "</tt>', parse("(('text \\\"'))")
162
+ end
163
+
164
+ def test_parse_verb_multiple
165
+ assert_equal '<tt>((*text*))</tt>', parse("(('((*text*))'))")
166
+ end
167
+
168
+ def parse text
169
+ @inline_parser.parse text
170
+ end
171
+
172
+ end
173
+
@@ -1,15 +1,9 @@
1
- require 'rubygems'
2
- require 'minitest/autorun'
3
- require 'rdoc/rdoc'
1
+ require 'rdoc/test_case'
4
2
 
5
- require 'fileutils'
6
- require 'tempfile'
7
- require 'tmpdir'
8
-
9
- class TestRDocRDoc < MiniTest::Unit::TestCase
3
+ class TestRDocRDoc < RDoc::TestCase
10
4
 
11
5
  def setup
12
- RDoc::TopLevel.reset
6
+ super
13
7
 
14
8
  @rdoc = RDoc::RDoc.new
15
9
  @rdoc.options = RDoc::Options.new
@@ -19,6 +13,8 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
19
13
  end
20
14
 
21
15
  def test_class_reset
16
+ RDoc::RDoc.current = :junk
17
+
22
18
  tl = RDoc::TopLevel.new 'file.rb'
23
19
  tl.add_class RDoc::NormalClass, 'C'
24
20
  tl.add_class RDoc::NormalModule, 'M'
@@ -31,6 +27,8 @@ class TestRDocRDoc < MiniTest::Unit::TestCase
31
27
 
32
28
  RDoc::RDoc.reset
33
29
 
30
+ assert_nil RDoc::RDoc.current
31
+
34
32
  assert_empty RDoc::TopLevel.all_classes_hash
35
33
  assert_empty RDoc::TopLevel.all_files_hash
36
34
  assert_empty RDoc::TopLevel.all_modules_hash
@@ -1,16 +1,9 @@
1
- require 'pp'
2
- require 'rubygems'
3
- require 'minitest/autorun'
4
- require 'tmpdir'
5
- require 'fileutils'
6
- require 'stringio'
7
- require 'rdoc/ri/driver'
8
- require 'rdoc/rdoc'
1
+ require 'rdoc/test_case'
9
2
 
10
- class TestRDocRIDriver < MiniTest::Unit::TestCase
3
+ class TestRDocRIDriver < RDoc::TestCase
11
4
 
12
5
  def setup
13
- @RM = RDoc::Markup
6
+ super
14
7
 
15
8
  @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}"
16
9
  @home_ri = File.join @tmpdir, 'dot_ri'
@@ -31,6 +24,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
31
24
  end
32
25
 
33
26
  def teardown
27
+ super
28
+
34
29
  ENV['HOME'] = @orig_home
35
30
  ENV['RI'] = @orig_ri
36
31
  FileUtils.rm_rf @tmpdir
@@ -85,8 +80,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
85
80
  expected = @RM::Document.new(
86
81
  @RM::Rule.new(1),
87
82
  @RM::Paragraph.new('Also found in:'),
88
- @RM::Verbatim.new("ruby core\n",
89
- "~/.ri\n"))
83
+ @RM::Verbatim.new("ruby core", "\n",
84
+ "~/.ri", "\n"))
90
85
 
91
86
  assert_equal expected, out
92
87
  end
@@ -145,7 +140,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
145
140
  @RM::BlankLine.new,
146
141
  @RM::Paragraph.new("Include thingy"),
147
142
  @RM::BlankLine.new,
148
- @RM::Verbatim.new("Enumerable\n"))
143
+ @RM::Verbatim.new("Enumerable", "\n"))
149
144
 
150
145
  assert_equal expected, out
151
146
  end
@@ -165,8 +160,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
165
160
  @RM::Rule.new(1),
166
161
  @RM::Heading.new(1, "Includes:"),
167
162
  @RM::Paragraph.new("(from #{@store.friendly_path})"),
168
- @RM::Verbatim.new("Inc\n",
169
- "Enumerable\n"))
163
+ @RM::Verbatim.new("Inc", "\n",
164
+ "Enumerable", "\n"))
170
165
 
171
166
  assert_equal expected, out
172
167
  end
@@ -1,16 +1,16 @@
1
- require 'rubygems'
2
- require 'minitest/autorun'
3
- require 'tmpdir'
4
- require 'fileutils'
5
- require 'rdoc/ri/paths'
1
+ require 'rdoc/test_case'
6
2
 
7
- class TestRDocRIPaths < MiniTest::Unit::TestCase
3
+ class TestRDocRIPaths < RDoc::TestCase
8
4
 
9
5
  def setup
6
+ super
7
+
10
8
  RDoc::RI::Paths.instance_variable_set :@gemdirs, %w[/nonexistent/gemdir]
11
9
  end
12
10
 
13
11
  def teardown
12
+ super
13
+
14
14
  RDoc::RI::Paths.instance_variable_set :@gemdirs, nil
15
15
  end
16
16
 
@@ -1,18 +1,11 @@
1
- require 'rubygems'
2
- require 'minitest/autorun'
3
- require 'rdoc/rdoc'
4
- require 'rdoc/ri'
5
- require 'rdoc/markup'
6
- require 'tmpdir'
7
- require 'fileutils'
8
- require 'pp'
1
+ require 'rdoc/test_case'
9
2
 
10
- class TestRDocRIStore < MiniTest::Unit::TestCase
3
+ class TestRDocRIStore < RDoc::TestCase
11
4
 
12
5
  OBJECT_ANCESTORS = defined?(::BasicObject) ? %w[BasicObject] : []
13
6
 
14
7
  def setup
15
- RDoc::TopLevel.reset
8
+ super
16
9
 
17
10
  @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_store_#{$$}"
18
11
  @s = RDoc::RI::Store.new @tmpdir
@@ -49,11 +42,11 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
49
42
 
50
43
  @nest_klass.add_method @nest_meth
51
44
  @nest_klass.add_include @nest_incl
52
-
53
- @RM = RDoc::Markup
54
45
  end
55
46
 
56
47
  def teardown
48
+ super
49
+
57
50
  FileUtils.rm_rf @tmpdir
58
51
  end
59
52
 
@@ -386,7 +379,7 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
386
379
  s = RDoc::RI::Store.new @tmpdir
387
380
 
388
381
  inner = @RM::Document.new @RM::Paragraph.new 'new comment'
389
- inner.file = @top_level.absolute_name
382
+ inner.file = @top_level
390
383
 
391
384
  document = @RM::Document.new inner
392
385
 
@@ -1,9 +1,55 @@
1
- require 'rubygems'
2
- require 'minitest/autorun'
3
- require 'rdoc/rdoc'
4
- require 'rdoc/ruby_lex'
1
+ require 'rdoc/test_case'
2
+
3
+ class TestRDocRubyLex < RDoc::TestCase
4
+
5
+ def setup
6
+ @TK = RDoc::RubyToken
7
+ end
8
+
9
+ def mu_pp obj
10
+ s = ''
11
+ s = PP.pp obj, s
12
+ s = s.force_encoding(Encoding.default_external) if defined? Encoding
13
+ s.chomp
14
+ end
15
+
16
+ def test_class_tokenize
17
+ tokens = RDoc::RubyLex.tokenize "def x() end", nil
18
+
19
+ expected = [
20
+ @TK::TkDEF .new( 0, 1, 0, "def"),
21
+ @TK::TkSPACE .new( 3, 1, 3, " "),
22
+ @TK::TkIDENTIFIER.new( 4, 1, 4, "x"),
23
+ @TK::TkLPAREN .new( 5, 1, 5, "("),
24
+ @TK::TkRPAREN .new( 6, 1, 6, ")"),
25
+ @TK::TkSPACE .new( 7, 1, 7, " "),
26
+ @TK::TkEND .new( 8, 1, 8, "end"),
27
+ @TK::TkNL .new(11, 1, 11, "\n"),
28
+ ]
29
+
30
+ assert_equal expected, tokens
31
+ end
32
+
33
+ def test_class_tokenize_heredoc
34
+ tokens = RDoc::RubyLex.tokenize <<-'RUBY', nil
35
+ string = <<-STRING
36
+ Line 1
37
+ Line 2
38
+ STRING
39
+ RUBY
40
+
41
+ expected = [
42
+ @TK::TkIDENTIFIER.new( 0, 1, 0, 'string'),
43
+ @TK::TkSPACE .new( 6, 1, 6, ' '),
44
+ @TK::TkASSIGN .new( 7, 1, 7, '='),
45
+ @TK::TkSPACE .new( 8, 1, 8, ' '),
46
+ @TK::TkSTRING .new( 9, 1, 9, %Q{"Line 1\nLine 2\n"}),
47
+ @TK::TkNL .new(39, 4, 40, "\n"),
48
+ ]
49
+
50
+ assert_equal expected, tokens
51
+ end
5
52
 
6
- class TestRubyLex < MiniTest::Unit::TestCase
7
53
  def test_unary_minus
8
54
  ruby_lex = RDoc::RubyLex.new("-1", nil)
9
55
  assert_equal("-1", ruby_lex.token.value)
@@ -20,4 +66,6 @@ class TestRubyLex < MiniTest::Unit::TestCase
20
66
  2.times { ruby_lex.token } # skip "0" and "+"
21
67
  assert_equal("-0.1", ruby_lex.token.value)
22
68
  end
69
+
23
70
  end
71
+