rdoc 4.2.1 → 6.3.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 (277) hide show
  1. checksums.yaml +5 -5
  2. data/CONTRIBUTING.rdoc +8 -7
  3. data/Gemfile +12 -0
  4. data/History.rdoc +48 -4
  5. data/LEGAL.rdoc +2 -2
  6. data/README.rdoc +5 -5
  7. data/Rakefile +73 -155
  8. data/bin/console +7 -0
  9. data/bin/setup +6 -0
  10. data/{bin → exe}/rdoc +0 -0
  11. data/{bin → exe}/ri +0 -0
  12. data/lib/rdoc/alias.rb +1 -0
  13. data/lib/rdoc/anon_class.rb +1 -0
  14. data/lib/rdoc/any_method.rb +59 -14
  15. data/lib/rdoc/attr.rb +1 -0
  16. data/lib/rdoc/class_module.rb +5 -2
  17. data/lib/rdoc/code_object.rb +3 -11
  18. data/lib/rdoc/code_objects.rb +1 -0
  19. data/lib/rdoc/comment.rb +32 -11
  20. data/lib/rdoc/constant.rb +3 -2
  21. data/lib/rdoc/context/section.rb +7 -13
  22. data/lib/rdoc/context.rb +78 -23
  23. data/lib/rdoc/cross_reference.rb +33 -14
  24. data/lib/rdoc/encoding.rb +92 -55
  25. data/lib/rdoc/erb_partial.rb +2 -1
  26. data/lib/rdoc/erbio.rb +8 -3
  27. data/lib/rdoc/extend.rb +1 -0
  28. data/lib/rdoc/generator/darkfish.rb +62 -32
  29. data/lib/rdoc/generator/json_index.rb +8 -5
  30. data/lib/rdoc/generator/markup.rb +3 -12
  31. data/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  32. data/lib/rdoc/generator/pot/po.rb +84 -0
  33. data/lib/rdoc/generator/pot/po_entry.rb +141 -0
  34. data/lib/rdoc/generator/pot.rb +4 -3
  35. data/lib/rdoc/generator/ri.rb +1 -0
  36. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
  37. data/lib/rdoc/generator/template/darkfish/_head.rhtml +11 -8
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
  40. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
  41. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
  42. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
  43. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
  44. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
  45. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  46. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
  47. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  48. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
  49. data/lib/rdoc/generator/template/darkfish/class.rhtml +45 -47
  50. data/lib/rdoc/generator/template/darkfish/css/fonts.css +6 -6
  51. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +55 -6
  52. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
  53. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +23 -100
  54. data/lib/rdoc/generator/template/darkfish/js/search.js +32 -31
  55. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
  56. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
  57. data/lib/rdoc/generator/template/json_index/js/navigation.js +4 -41
  58. data/lib/rdoc/generator/template/json_index/js/searcher.js +7 -6
  59. data/lib/rdoc/generator.rb +1 -1
  60. data/lib/rdoc/ghost_method.rb +1 -0
  61. data/lib/rdoc/i18n/locale.rb +2 -1
  62. data/lib/rdoc/i18n/text.rb +5 -4
  63. data/lib/rdoc/i18n.rb +3 -2
  64. data/lib/rdoc/include.rb +1 -0
  65. data/lib/rdoc/known_classes.rb +1 -0
  66. data/lib/rdoc/markdown/entities.rb +1 -0
  67. data/lib/rdoc/markdown/{literals_1_9.kpeg → literals.kpeg} +1 -0
  68. data/lib/rdoc/markdown/{literals_1_9.rb → literals.rb} +1 -4
  69. data/lib/rdoc/markdown.kpeg +94 -51
  70. data/lib/rdoc/markdown.rb +1171 -619
  71. data/lib/rdoc/markup/attr_changer.rb +1 -0
  72. data/lib/rdoc/markup/attr_span.rb +9 -2
  73. data/lib/rdoc/markup/attribute_manager.rb +115 -49
  74. data/lib/rdoc/markup/attributes.rb +7 -6
  75. data/lib/rdoc/markup/blank_line.rb +1 -0
  76. data/lib/rdoc/markup/block_quote.rb +1 -0
  77. data/lib/rdoc/markup/document.rb +1 -0
  78. data/lib/rdoc/markup/formatter.rb +25 -23
  79. data/lib/rdoc/markup/hard_break.rb +1 -0
  80. data/lib/rdoc/markup/heading.rb +4 -3
  81. data/lib/rdoc/markup/include.rb +1 -0
  82. data/lib/rdoc/markup/indented_paragraph.rb +1 -0
  83. data/lib/rdoc/markup/list.rb +1 -0
  84. data/lib/rdoc/markup/list_item.rb +1 -0
  85. data/lib/rdoc/markup/paragraph.rb +1 -0
  86. data/lib/rdoc/markup/parser.rb +78 -61
  87. data/lib/rdoc/markup/pre_process.rb +12 -9
  88. data/lib/rdoc/markup/raw.rb +1 -0
  89. data/lib/rdoc/markup/regexp_handling.rb +41 -0
  90. data/lib/rdoc/markup/rule.rb +1 -0
  91. data/lib/rdoc/markup/to_ansi.rb +1 -0
  92. data/lib/rdoc/markup/to_bs.rb +4 -5
  93. data/lib/rdoc/markup/to_html.rb +71 -25
  94. data/lib/rdoc/markup/to_html_crossref.rb +41 -25
  95. data/lib/rdoc/markup/to_html_snippet.rb +10 -9
  96. data/lib/rdoc/markup/to_joined_paragraph.rb +7 -31
  97. data/lib/rdoc/markup/to_label.rb +10 -9
  98. data/lib/rdoc/markup/to_markdown.rb +9 -8
  99. data/lib/rdoc/markup/to_rdoc.rb +35 -6
  100. data/lib/rdoc/markup/to_table_of_contents.rb +2 -0
  101. data/lib/rdoc/markup/to_test.rb +1 -0
  102. data/lib/rdoc/markup/to_tt_only.rb +3 -2
  103. data/lib/rdoc/markup/verbatim.rb +1 -0
  104. data/lib/rdoc/markup.rb +14 -16
  105. data/lib/rdoc/meta_method.rb +1 -0
  106. data/lib/rdoc/method_attr.rb +2 -1
  107. data/lib/rdoc/mixin.rb +1 -0
  108. data/lib/rdoc/normal_class.rb +3 -2
  109. data/lib/rdoc/normal_module.rb +1 -0
  110. data/lib/rdoc/options.rb +92 -58
  111. data/lib/rdoc/parser/c.rb +219 -223
  112. data/lib/rdoc/parser/changelog.rb +155 -18
  113. data/lib/rdoc/parser/markdown.rb +1 -0
  114. data/lib/rdoc/parser/rd.rb +1 -0
  115. data/lib/rdoc/parser/ripper_state_lex.rb +590 -0
  116. data/lib/rdoc/parser/ruby.rb +635 -468
  117. data/lib/rdoc/parser/ruby_tools.rb +33 -33
  118. data/lib/rdoc/parser/simple.rb +3 -3
  119. data/lib/rdoc/parser/text.rb +1 -0
  120. data/lib/rdoc/parser.rb +17 -50
  121. data/lib/rdoc/rd/block_parser.rb +66 -65
  122. data/lib/rdoc/rd/block_parser.ry +3 -3
  123. data/lib/rdoc/rd/inline.rb +5 -4
  124. data/lib/rdoc/rd/inline_parser.rb +52 -51
  125. data/lib/rdoc/rd/inline_parser.ry +1 -1
  126. data/lib/rdoc/rd.rb +1 -0
  127. data/lib/rdoc/rdoc.rb +68 -63
  128. data/lib/rdoc/require.rb +1 -0
  129. data/lib/rdoc/ri/driver.rb +133 -58
  130. data/lib/rdoc/ri/formatter.rb +1 -0
  131. data/lib/rdoc/ri/paths.rb +4 -20
  132. data/lib/rdoc/ri/store.rb +1 -0
  133. data/lib/rdoc/ri/task.rb +71 -0
  134. data/lib/rdoc/ri.rb +1 -0
  135. data/lib/rdoc/rubygems_hook.rb +5 -12
  136. data/lib/rdoc/servlet.rb +24 -14
  137. data/lib/rdoc/single_class.rb +1 -0
  138. data/lib/rdoc/stats/normal.rb +20 -21
  139. data/lib/rdoc/stats/quiet.rb +1 -0
  140. data/lib/rdoc/stats/verbose.rb +1 -0
  141. data/lib/rdoc/stats.rb +1 -0
  142. data/lib/rdoc/store.rb +41 -41
  143. data/lib/rdoc/task.rb +2 -3
  144. data/lib/rdoc/text.rb +19 -38
  145. data/lib/rdoc/token_stream.rb +56 -32
  146. data/lib/rdoc/tom_doc.rb +17 -11
  147. data/lib/rdoc/top_level.rb +9 -2
  148. data/lib/rdoc/version.rb +8 -0
  149. data/lib/rdoc.rb +24 -10
  150. data/man/ri.1 +247 -0
  151. data/rdoc.gemspec +248 -0
  152. metadata +43 -236
  153. data/.autotest +0 -24
  154. data/.document +0 -5
  155. data/Manifest.txt +0 -306
  156. data/lib/gauntlet_rdoc.rb +0 -84
  157. data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -4
  158. data/lib/rdoc/markdown/literals_1_8.kpeg +0 -18
  159. data/lib/rdoc/markdown/literals_1_8.rb +0 -416
  160. data/lib/rdoc/markup/formatter_test_case.rb +0 -767
  161. data/lib/rdoc/markup/inline.rb +0 -1
  162. data/lib/rdoc/markup/special.rb +0 -40
  163. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -114
  164. data/lib/rdoc/ruby_lex.rb +0 -1377
  165. data/lib/rdoc/ruby_token.rb +0 -460
  166. data/lib/rdoc/test_case.rb +0 -217
  167. data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +0 -21
  168. data/test/MarkdownTest_1.0.3/Auto links.text +0 -13
  169. data/test/MarkdownTest_1.0.3/Backslash escapes.text +0 -120
  170. data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +0 -11
  171. data/test/MarkdownTest_1.0.3/Code Blocks.text +0 -14
  172. data/test/MarkdownTest_1.0.3/Code Spans.text +0 -6
  173. data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +0 -8
  174. data/test/MarkdownTest_1.0.3/Horizontal rules.text +0 -67
  175. data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +0 -15
  176. data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +0 -69
  177. data/test/MarkdownTest_1.0.3/Inline HTML comments.text +0 -13
  178. data/test/MarkdownTest_1.0.3/Links, inline style.text +0 -12
  179. data/test/MarkdownTest_1.0.3/Links, reference style.text +0 -71
  180. data/test/MarkdownTest_1.0.3/Links, shortcut references.text +0 -20
  181. data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +0 -7
  182. data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +0 -306
  183. data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +0 -888
  184. data/test/MarkdownTest_1.0.3/Nested blockquotes.text +0 -5
  185. data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +0 -131
  186. data/test/MarkdownTest_1.0.3/Strong and em together.text +0 -7
  187. data/test/MarkdownTest_1.0.3/Tabs.text +0 -21
  188. data/test/MarkdownTest_1.0.3/Tidyness.text +0 -5
  189. data/test/README +0 -1
  190. data/test/binary.dat +0 -0
  191. data/test/hidden.zip.txt +0 -1
  192. data/test/test.ja.largedoc +0 -3
  193. data/test/test.ja.rdoc +0 -10
  194. data/test/test.ja.txt +0 -8
  195. data/test/test.txt +0 -1
  196. data/test/test_rdoc_alias.rb +0 -13
  197. data/test/test_rdoc_any_method.rb +0 -460
  198. data/test/test_rdoc_attr.rb +0 -190
  199. data/test/test_rdoc_class_module.rb +0 -1492
  200. data/test/test_rdoc_code_object.rb +0 -450
  201. data/test/test_rdoc_comment.rb +0 -504
  202. data/test/test_rdoc_constant.rb +0 -181
  203. data/test/test_rdoc_context.rb +0 -901
  204. data/test/test_rdoc_context_section.rb +0 -130
  205. data/test/test_rdoc_cross_reference.rb +0 -192
  206. data/test/test_rdoc_encoding.rb +0 -227
  207. data/test/test_rdoc_extend.rb +0 -94
  208. data/test/test_rdoc_generator_darkfish.rb +0 -229
  209. data/test/test_rdoc_generator_json_index.rb +0 -324
  210. data/test/test_rdoc_generator_markup.rb +0 -59
  211. data/test/test_rdoc_generator_pot.rb +0 -91
  212. data/test/test_rdoc_generator_pot_po.rb +0 -51
  213. data/test/test_rdoc_generator_pot_po_entry.rb +0 -139
  214. data/test/test_rdoc_generator_ri.rb +0 -78
  215. data/test/test_rdoc_i18n_locale.rb +0 -73
  216. data/test/test_rdoc_i18n_text.rb +0 -123
  217. data/test/test_rdoc_include.rb +0 -108
  218. data/test/test_rdoc_markdown.rb +0 -980
  219. data/test/test_rdoc_markdown_test.rb +0 -1884
  220. data/test/test_rdoc_markup.rb +0 -95
  221. data/test/test_rdoc_markup_attribute_manager.rb +0 -364
  222. data/test/test_rdoc_markup_attributes.rb +0 -39
  223. data/test/test_rdoc_markup_document.rb +0 -207
  224. data/test/test_rdoc_markup_formatter.rb +0 -175
  225. data/test/test_rdoc_markup_hard_break.rb +0 -31
  226. data/test/test_rdoc_markup_heading.rb +0 -29
  227. data/test/test_rdoc_markup_include.rb +0 -19
  228. data/test/test_rdoc_markup_indented_paragraph.rb +0 -53
  229. data/test/test_rdoc_markup_paragraph.rb +0 -32
  230. data/test/test_rdoc_markup_parser.rb +0 -1680
  231. data/test/test_rdoc_markup_pre_process.rb +0 -473
  232. data/test/test_rdoc_markup_raw.rb +0 -22
  233. data/test/test_rdoc_markup_to_ansi.rb +0 -369
  234. data/test/test_rdoc_markup_to_bs.rb +0 -366
  235. data/test/test_rdoc_markup_to_html.rb +0 -662
  236. data/test/test_rdoc_markup_to_html_crossref.rb +0 -225
  237. data/test/test_rdoc_markup_to_html_snippet.rb +0 -711
  238. data/test/test_rdoc_markup_to_joined_paragraph.rb +0 -32
  239. data/test/test_rdoc_markup_to_label.rb +0 -112
  240. data/test/test_rdoc_markup_to_markdown.rb +0 -389
  241. data/test/test_rdoc_markup_to_rdoc.rb +0 -377
  242. data/test/test_rdoc_markup_to_table_of_contents.rb +0 -126
  243. data/test/test_rdoc_markup_to_tt_only.rb +0 -246
  244. data/test/test_rdoc_markup_verbatim.rb +0 -29
  245. data/test/test_rdoc_method_attr.rb +0 -193
  246. data/test/test_rdoc_normal_class.rb +0 -47
  247. data/test/test_rdoc_normal_module.rb +0 -42
  248. data/test/test_rdoc_options.rb +0 -766
  249. data/test/test_rdoc_parser.rb +0 -327
  250. data/test/test_rdoc_parser_c.rb +0 -1896
  251. data/test/test_rdoc_parser_changelog.rb +0 -315
  252. data/test/test_rdoc_parser_markdown.rb +0 -61
  253. data/test/test_rdoc_parser_rd.rb +0 -55
  254. data/test/test_rdoc_parser_ruby.rb +0 -3322
  255. data/test/test_rdoc_parser_simple.rb +0 -115
  256. data/test/test_rdoc_rd.rb +0 -30
  257. data/test/test_rdoc_rd_block_parser.rb +0 -535
  258. data/test/test_rdoc_rd_inline.rb +0 -63
  259. data/test/test_rdoc_rd_inline_parser.rb +0 -177
  260. data/test/test_rdoc_rdoc.rb +0 -455
  261. data/test/test_rdoc_require.rb +0 -25
  262. data/test/test_rdoc_ri_driver.rb +0 -1436
  263. data/test/test_rdoc_ri_paths.rb +0 -155
  264. data/test/test_rdoc_ruby_lex.rb +0 -421
  265. data/test/test_rdoc_ruby_token.rb +0 -19
  266. data/test/test_rdoc_rubygems_hook.rb +0 -251
  267. data/test/test_rdoc_servlet.rb +0 -534
  268. data/test/test_rdoc_single_class.rb +0 -20
  269. data/test/test_rdoc_stats.rb +0 -722
  270. data/test/test_rdoc_store.rb +0 -993
  271. data/test/test_rdoc_task.rb +0 -173
  272. data/test/test_rdoc_text.rb +0 -557
  273. data/test/test_rdoc_token_stream.rb +0 -42
  274. data/test/test_rdoc_tom_doc.rb +0 -520
  275. data/test/test_rdoc_top_level.rb +0 -287
  276. data/test/xref_data.rb +0 -76
  277. data/test/xref_test_case.rb +0 -67
@@ -1,63 +0,0 @@
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
-
@@ -1,177 +0,0 @@
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
- blank_line,
31
- ]
32
-
33
- assert_equal expected, @block_parser.footnotes
34
- end
35
-
36
- def test_parse_index
37
- assert_equal '<span id="label-text">text</span>', parse('((:text:))')
38
-
39
- assert_includes @block_parser.labels, 'text'
40
- end
41
-
42
- def test_parse_kbd
43
- assert_equal '<tt>text</tt>', parse('((%text%))')
44
- end
45
-
46
- def test_parse_multiple
47
- assert_equal '<em>one</em> <em>two</em>', parse('((*one*)) ((*two*))')
48
- end
49
-
50
- def test_parse_newline
51
- assert_equal "one\ntwo", parse("one\ntwo")
52
- end
53
-
54
- def test_parse_quote
55
- assert_equal 'one " two', parse('one " two')
56
- end
57
-
58
- def test_parse_ref
59
- assert_equal '{text}[rdoc-label:text]', parse('((<text>))')
60
- end
61
-
62
- def test_parse_ref_em
63
- assert_equal '{<em>text</em>}[rdoc-label:text]', parse('((<((*text*))>))')
64
- end
65
-
66
- def test_parse_ref_filename_quote
67
- assert_equal '{RD/foo}[rdoc-label:RD/foo]', parse('((<RD/"foo">))')
68
- end
69
-
70
- def test_parse_ref_filename
71
- assert_equal '{RD}[rdoc-label:RD/]', parse('((<RD/>))')
72
- end
73
-
74
- def test_parse_ref_quote
75
- assert_equal '{text \\"}[rdoc-label:text \\"]', parse('((<text \">))')
76
- end
77
-
78
- def test_parse_ref_quote_content
79
- assert_equal '{<em>text</em>}[rdoc-label:text]',
80
- parse('((<"((*text*))">))')
81
- end
82
-
83
- def test_parse_ref_quote_content_multi
84
- assert_equal '{<em>one</em> <em>two</em>}[rdoc-label:one two]',
85
- parse('((<"((*one*)) ((*two*))">))')
86
- end
87
-
88
- def test_parse_ref_substitute
89
- assert_equal '{text}[rdoc-label:thing]', parse('((<text|thing>))')
90
- end
91
-
92
- def test_parse_ref_substitute_element_quote
93
- assert_equal '{text}[rdoc-label:"RD"]',
94
- parse('((<text|"RD">))')
95
- end
96
-
97
- def test_parse_ref_substitute_filename
98
- assert_equal '{text}[rdoc-label:RD/]', parse('((<text|RD/>))')
99
- end
100
-
101
- def test_parse_ref_substitute_filename_label
102
- assert_equal '{text}[rdoc-label:RD/label]',
103
- parse('((<text|RD/label>))')
104
- end
105
-
106
- def test_parse_ref_substitute_filename_quote
107
- assert_equal '{text}[rdoc-label:"RD"/]', parse('((<text|"RD"/>))')
108
- end
109
-
110
- def test_parse_ref_substitute_multi_content
111
- assert_equal '{<em>one</em> two}[rdoc-label:thing]',
112
- parse('((<((*one*)) two|thing>))')
113
- end
114
-
115
- def test_parse_ref_substitute_multi_content2
116
- assert_equal '{<em>one</em> \\" two}[rdoc-label:thing]',
117
- parse('((<((*one*)) \" two|thing>))')
118
- end
119
-
120
- def test_parse_ref_substitute_multi_content3
121
- assert_equal '{<em>one</em> \\" <em>two</em>}[rdoc-label:thing]',
122
- parse('((<((*one*)) \" ((*two*))|thing>))')
123
- end
124
-
125
- def test_parse_ref_substitute_quote
126
- assert_equal '{one | two}[rdoc-label:thing]',
127
- parse('((<"one | two"|thing>))')
128
- end
129
-
130
- def test_parse_ref_substitute_quote_content
131
- assert_equal '{<em>text</em>}[rdoc-label:thing]',
132
- parse('((<"((*text*))"|thing>))')
133
- end
134
-
135
- def test_parse_ref_substitute_url
136
- assert_equal '{text}[http://example]',
137
- parse('((<text|URL:http://example>))')
138
- end
139
-
140
- def test_parse_ref_url
141
- assert_equal '{http://example}[http://example]',
142
- parse('((<URL:http://example>))')
143
- end
144
-
145
- def test_parse_var
146
- assert_equal '+text+', parse('((|text|))')
147
- end
148
-
149
- def test_parse_verb
150
- assert_equal '<tt>text</tt>', parse("(('text'))")
151
- end
152
-
153
- def test_parse_verb_backslash
154
- assert_equal "<tt>(('text'))</tt>", parse("(('(('text\\'))'))")
155
- end
156
-
157
- def test_parse_verb_backslash_backslash
158
- assert_equal '<tt>text \\</tt>', parse("(('text \\\\'))")
159
- end
160
-
161
- def test_parse_verb_backslash_quote
162
- assert_equal '<tt>text "</tt>', parse("(('text \\\"'))")
163
- end
164
-
165
- def test_parse_verb_emphasis
166
- assert_equal '<tt>((*emphasis*))</tt>', parse("(('((*emphasis*))'))")
167
- end
168
-
169
- def test_parse_verb_multiple
170
- assert_equal '<tt>((*text*))</tt>', parse("(('((*text*))'))")
171
- end
172
-
173
- def parse text
174
- @inline_parser.parse text
175
- end
176
-
177
- end
@@ -1,455 +0,0 @@
1
- require 'rdoc/test_case'
2
-
3
- class TestRDocRDoc < RDoc::TestCase
4
-
5
- def setup
6
- super
7
-
8
- @rdoc = RDoc::RDoc.new
9
- @rdoc.options = RDoc::Options.new
10
-
11
- @stats = RDoc::Stats.new @store, 0, 0
12
- @rdoc.instance_variable_set :@stats, @stats
13
- end
14
-
15
- def test_document # functional test
16
- options = RDoc::Options.new
17
- options.files = [File.expand_path('../xref_data.rb', __FILE__)]
18
- options.setup_generator 'ri'
19
- options.main_page = 'MAIN_PAGE.rdoc'
20
- options.root = Pathname File.expand_path('..', __FILE__)
21
- options.title = 'title'
22
-
23
- rdoc = RDoc::RDoc.new
24
-
25
- temp_dir do
26
- options.op_dir = 'ri'
27
-
28
- capture_io do
29
- rdoc.document options
30
- end
31
-
32
- assert File.directory? 'ri'
33
- assert_equal rdoc, rdoc.store.rdoc
34
- end
35
-
36
- store = rdoc.store
37
-
38
- assert_equal 'MAIN_PAGE.rdoc', store.main
39
- assert_equal 'title', store.title
40
- end
41
-
42
- def test_gather_files
43
- a = File.expand_path __FILE__
44
- b = File.expand_path '../test_rdoc_text.rb', __FILE__
45
-
46
- assert_equal [a, b], @rdoc.gather_files([b, a, b])
47
- end
48
-
49
- def test_handle_pipe
50
- $stdin = StringIO.new "hello"
51
-
52
- out, = capture_io do
53
- @rdoc.handle_pipe
54
- end
55
-
56
- assert_equal "\n<p>hello</p>\n", out
57
- ensure
58
- $stdin = STDIN
59
- end
60
-
61
- def test_handle_pipe_rd
62
- $stdin = StringIO.new "=begin\nhello\n=end"
63
-
64
- @rdoc.options.markup = 'rd'
65
-
66
- out, = capture_io do
67
- @rdoc.handle_pipe
68
- end
69
-
70
- assert_equal "\n<p>hello</p>\n", out
71
- ensure
72
- $stdin = STDIN
73
- end
74
-
75
- def test_load_options
76
- temp_dir do
77
- options = RDoc::Options.new
78
- options.markup = 'tomdoc'
79
- options.write_options
80
-
81
- options = @rdoc.load_options
82
-
83
- assert_equal 'tomdoc', options.markup
84
- end
85
- end
86
-
87
- def test_load_options_invalid
88
- temp_dir do
89
- open '.rdoc_options', 'w' do |io|
90
- io.write "a: !ruby.yaml.org,2002:str |\nfoo"
91
- end
92
-
93
- e = assert_raises RDoc::Error do
94
- @rdoc.load_options
95
- end
96
-
97
- options_file = File.expand_path '.rdoc_options'
98
- assert_equal "#{options_file} is not a valid rdoc options file", e.message
99
- end
100
- end
101
-
102
- def load_options_no_file
103
- temp_dir do
104
- options = @rdoc.load_options
105
-
106
- assert_kind_of RDoc::Options, options
107
- end
108
- end
109
-
110
- def test_normalized_file_list
111
- files = temp_dir do |dir|
112
- flag_file = @rdoc.output_flag_file dir
113
-
114
- FileUtils.touch flag_file
115
-
116
- @rdoc.normalized_file_list [__FILE__, flag_file]
117
- end
118
-
119
- files = files.map { |file| File.expand_path file }
120
-
121
- assert_equal [File.expand_path(__FILE__)], files
122
- end
123
-
124
- def test_normalized_file_list_not_modified
125
- files = [__FILE__]
126
-
127
- @rdoc.last_modified[__FILE__] = File.stat(__FILE__).mtime
128
-
129
- files = @rdoc.normalized_file_list [__FILE__]
130
-
131
- assert_empty files
132
- end
133
-
134
- def test_normalized_file_list_non_file_directory
135
- dev = defined?(File::NULL) ? File::NULL : '/dev/stdin'
136
- skip "#{dev} is not a character special" unless
137
- File.chardev? dev
138
-
139
- files = nil
140
-
141
- out, err = verbose_capture_io do
142
- files = @rdoc.normalized_file_list [dev]
143
- end
144
-
145
- files = files.map { |file| File.expand_path file }
146
-
147
- assert_empty files
148
-
149
- assert_empty out
150
- assert_match %r"^rdoc can't parse", err
151
- assert_match %r"#{dev}$", err
152
- end
153
-
154
- def test_parse_file
155
- @rdoc.store = RDoc::Store.new
156
-
157
- temp_dir do |dir|
158
- @rdoc.options.root = Pathname(Dir.pwd)
159
-
160
- open 'test.txt', 'w' do |io|
161
- io.puts 'hi'
162
- end
163
-
164
- top_level = @rdoc.parse_file 'test.txt'
165
-
166
- assert_equal 'test.txt', top_level.absolute_name
167
- assert_equal 'test.txt', top_level.relative_name
168
- end
169
- end
170
-
171
- def test_parse_file_binary
172
- @rdoc.store = RDoc::Store.new
173
-
174
- root = File.dirname __FILE__
175
-
176
- @rdoc.options.root = Pathname root
177
-
178
- out, err = capture_io do
179
- Dir.chdir root do
180
- assert_nil @rdoc.parse_file 'binary.dat'
181
- end
182
- end
183
-
184
- assert_empty out
185
- assert_empty err
186
- end
187
-
188
- def test_parse_file_include_root
189
- @rdoc.store = RDoc::Store.new
190
-
191
- top_level = nil
192
- temp_dir do |dir|
193
- @rdoc.options.parse %W[--root #{File.dirname(__FILE__)}]
194
-
195
- open 'include.txt', 'w' do |io|
196
- io.puts ':include: test.txt'
197
- end
198
-
199
- out, err = capture_io do
200
- top_level = @rdoc.parse_file 'include.txt'
201
- end
202
- assert_empty out
203
- assert_empty err
204
- end
205
- assert_equal "test file", top_level.comment.text
206
- end
207
-
208
- def test_parse_file_page_dir
209
- @rdoc.store = RDoc::Store.new
210
-
211
- temp_dir do |dir|
212
- FileUtils.mkdir 'pages'
213
- @rdoc.options.page_dir = Pathname('pages')
214
- @rdoc.options.root = Pathname(Dir.pwd)
215
-
216
- open 'pages/test.txt', 'w' do |io|
217
- io.puts 'hi'
218
- end
219
-
220
- top_level = @rdoc.parse_file 'pages/test.txt'
221
-
222
- assert_equal 'pages/test.txt', top_level.absolute_name
223
- assert_equal 'test.txt', top_level.relative_name
224
- end
225
- end
226
-
227
- def test_parse_file_relative
228
- pwd = Dir.pwd
229
-
230
- @rdoc.store = RDoc::Store.new
231
-
232
- temp_dir do |dir|
233
- @rdoc.options.root = Pathname(dir)
234
-
235
- open 'test.txt', 'w' do |io|
236
- io.puts 'hi'
237
- end
238
-
239
- test_txt = File.join dir, 'test.txt'
240
-
241
- Dir.chdir pwd do
242
- top_level = @rdoc.parse_file test_txt
243
-
244
- assert_equal test_txt, top_level.absolute_name
245
- assert_equal 'test.txt', top_level.relative_name
246
- end
247
- end
248
- end
249
-
250
- def test_parse_file_encoding
251
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
252
- @rdoc.options.encoding = Encoding::ISO_8859_1
253
- @rdoc.store = RDoc::Store.new
254
-
255
- tf = Tempfile.open 'test.txt' do |io|
256
- io.write 'hi'
257
- io.rewind
258
-
259
- top_level = @rdoc.parse_file io.path
260
-
261
- assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
262
- io
263
- end
264
- tf.close! if tf.respond_to? :close!
265
- end
266
-
267
- def test_parse_file_forbidden
268
- skip 'chmod not supported' if Gem.win_platform?
269
-
270
- @rdoc.store = RDoc::Store.new
271
-
272
- tf = Tempfile.open 'test.txt' do |io|
273
- io.write 'hi'
274
- io.rewind
275
-
276
- File.chmod 0000, io.path
277
-
278
- begin
279
- top_level = :bug
280
-
281
- _, err = capture_io do
282
- top_level = @rdoc.parse_file io.path
283
- end
284
-
285
- assert_match "Unable to read #{io.path},", err
286
-
287
- assert_nil top_level
288
- ensure
289
- File.chmod 0400, io.path
290
- end
291
- io
292
- end
293
- tf.close! if tf.respond_to? :close!
294
- end
295
-
296
- def test_remove_unparseable
297
- file_list = %w[
298
- blah.class
299
- blah.eps
300
- blah.erb
301
- blah.scpt.txt
302
- blah.ttf
303
- blah.yml
304
- ]
305
-
306
- assert_empty @rdoc.remove_unparseable file_list
307
- end
308
-
309
- def test_remove_unparseable_tags_emacs
310
- temp_dir do
311
- open 'TAGS', 'wb' do |io| # emacs
312
- io.write "\f\nlib/foo.rb,43\n"
313
- end
314
-
315
- file_list = %w[
316
- TAGS
317
- ]
318
-
319
- assert_empty @rdoc.remove_unparseable file_list
320
- end
321
- end
322
-
323
- def test_remove_unparseable_tags_vim
324
- temp_dir do
325
- open 'TAGS', 'w' do |io| # emacs
326
- io.write "!_TAG_"
327
- end
328
-
329
- file_list = %w[
330
- TAGS
331
- ]
332
-
333
- assert_empty @rdoc.remove_unparseable file_list
334
- end
335
- end
336
-
337
- def test_setup_output_dir
338
- Dir.mktmpdir {|d|
339
- path = File.join d, 'testdir'
340
-
341
- last = @rdoc.setup_output_dir path, false
342
-
343
- assert_empty last
344
-
345
- assert File.directory? path
346
- assert File.exist? @rdoc.output_flag_file path
347
- }
348
- end
349
-
350
- def test_setup_output_dir_dry_run
351
- @rdoc.options.dry_run = true
352
-
353
- Dir.mktmpdir do |d|
354
- path = File.join d, 'testdir'
355
-
356
- @rdoc.setup_output_dir path, false
357
-
358
- refute File.exist? path
359
- end
360
- end
361
-
362
- def test_setup_output_dir_exists
363
- Dir.mktmpdir {|path|
364
- open @rdoc.output_flag_file(path), 'w' do |io|
365
- io.puts Time.at 0
366
- io.puts "./lib/rdoc.rb\t#{Time.at 86400}"
367
- end
368
-
369
- last = @rdoc.setup_output_dir path, false
370
-
371
- assert_equal 1, last.size
372
- assert_equal Time.at(86400), last['./lib/rdoc.rb']
373
- }
374
- end
375
-
376
- def test_setup_output_dir_exists_empty_created_rid
377
- Dir.mktmpdir {|path|
378
- open @rdoc.output_flag_file(path), 'w' do end
379
-
380
- e = assert_raises RDoc::Error do
381
- @rdoc.setup_output_dir path, false
382
- end
383
-
384
- assert_match %r%Directory #{Regexp.escape path} already exists%, e.message
385
- }
386
- end
387
-
388
- def test_setup_output_dir_exists_file
389
- tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile|
390
- path = tempfile.path
391
-
392
- e = assert_raises RDoc::Error do
393
- @rdoc.setup_output_dir path, false
394
- end
395
-
396
- assert_match(%r%#{Regexp.escape path} exists and is not a directory%,
397
- e.message)
398
- tempfile
399
- end
400
- tf.close! if tf.respond_to? :close!
401
- end
402
-
403
- def test_setup_output_dir_exists_not_rdoc
404
- Dir.mktmpdir do |dir|
405
- e = assert_raises RDoc::Error do
406
- @rdoc.setup_output_dir dir, false
407
- end
408
-
409
- assert_match %r%Directory #{Regexp.escape dir} already exists%, e.message
410
- end
411
- end
412
-
413
- def test_update_output_dir
414
- Dir.mktmpdir do |d|
415
- @rdoc.update_output_dir d, Time.now, {}
416
-
417
- assert File.exist? "#{d}/created.rid"
418
- end
419
- end
420
-
421
- def test_update_output_dir_dont
422
- Dir.mktmpdir do |d|
423
- @rdoc.options.update_output_dir = false
424
- @rdoc.update_output_dir d, Time.now, {}
425
-
426
- refute File.exist? "#{d}/created.rid"
427
- end
428
- end
429
-
430
- def test_update_output_dir_dry_run
431
- Dir.mktmpdir do |d|
432
- @rdoc.options.dry_run = true
433
- @rdoc.update_output_dir d, Time.now, {}
434
-
435
- refute File.exist? "#{d}/created.rid"
436
- end
437
- end
438
-
439
- def test_normalized_file_list_removes_created_rid_dir
440
- temp_dir do |d|
441
- FileUtils.mkdir "doc"
442
- flag_file = @rdoc.output_flag_file "doc"
443
- file = File.join "doc", "test"
444
- FileUtils.touch flag_file
445
- FileUtils.touch file
446
-
447
- file_list = ["doc"]
448
-
449
- output = @rdoc.normalized_file_list file_list
450
-
451
- assert_empty output
452
- end
453
- end
454
- end
455
-
@@ -1,25 +0,0 @@
1
- require File.expand_path '../xref_test_case', __FILE__
2
-
3
- class TestRDocRequire < XrefTestCase
4
-
5
- def setup
6
- super
7
-
8
- @req = RDoc::Require.new 'foo', 'comment'
9
- end
10
-
11
- def test_initialize
12
- assert_equal 'foo', @req.name
13
-
14
- req = RDoc::Require.new '"foo"', ''
15
- assert_equal 'foo', @req.name
16
-
17
- req = RDoc::Require.new '\'foo\'', ''
18
- assert_equal 'foo', @req.name
19
-
20
- req = RDoc::Require.new '|foo|', ''
21
- assert_equal 'foo', @req.name, 'for fortran?'
22
- end
23
-
24
- end
25
-