rdoc 4.3.0 → 5.0.0.beta1

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 (248) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +13 -0
  3. data/.travis.yml +23 -0
  4. data/CONTRIBUTING.rdoc +4 -3
  5. data/Gemfile +3 -0
  6. data/History.rdoc +15 -4
  7. data/LEGAL.rdoc +2 -2
  8. data/README.rdoc +1 -0
  9. data/Rakefile +41 -79
  10. data/bin/console +7 -0
  11. data/bin/setup +6 -0
  12. data/{bin → exe}/rdoc +0 -0
  13. data/{bin → exe}/ri +0 -0
  14. data/lib/rdoc.rb +2 -1
  15. data/lib/rdoc/alias.rb +1 -0
  16. data/lib/rdoc/anon_class.rb +1 -0
  17. data/lib/rdoc/any_method.rb +1 -0
  18. data/lib/rdoc/attr.rb +1 -0
  19. data/lib/rdoc/class_module.rb +1 -0
  20. data/lib/rdoc/code_object.rb +1 -0
  21. data/lib/rdoc/code_objects.rb +1 -0
  22. data/lib/rdoc/comment.rb +1 -0
  23. data/lib/rdoc/constant.rb +1 -0
  24. data/lib/rdoc/context.rb +4 -1
  25. data/lib/rdoc/context/section.rb +7 -0
  26. data/lib/rdoc/cross_reference.rb +1 -0
  27. data/lib/rdoc/encoding.rb +14 -0
  28. data/lib/rdoc/erb_partial.rb +1 -0
  29. data/lib/rdoc/erbio.rb +1 -0
  30. data/lib/rdoc/extend.rb +1 -0
  31. data/lib/rdoc/generator.rb +1 -0
  32. data/lib/rdoc/generator/darkfish.rb +1 -0
  33. data/lib/rdoc/generator/json_index.rb +1 -0
  34. data/lib/rdoc/generator/markup.rb +1 -0
  35. data/lib/rdoc/generator/pot.rb +1 -0
  36. data/lib/rdoc/generator/pot/message_extractor.rb +1 -0
  37. data/lib/rdoc/generator/pot/po.rb +1 -0
  38. data/lib/rdoc/generator/pot/po_entry.rb +1 -0
  39. data/lib/rdoc/generator/ri.rb +1 -0
  40. data/lib/rdoc/generator/template/darkfish/_head.rhtml +2 -1
  41. data/lib/rdoc/generator/template/darkfish/css/fonts.css +6 -6
  42. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -7
  43. data/lib/rdoc/generator/template/json_index/js/searcher.js +1 -0
  44. data/lib/rdoc/ghost_method.rb +1 -0
  45. data/lib/rdoc/i18n.rb +1 -0
  46. data/lib/rdoc/i18n/locale.rb +1 -0
  47. data/lib/rdoc/i18n/text.rb +1 -0
  48. data/lib/rdoc/include.rb +1 -0
  49. data/lib/rdoc/known_classes.rb +1 -0
  50. data/lib/rdoc/markdown.kpeg +2 -6
  51. data/lib/rdoc/markdown.rb +2 -6
  52. data/lib/rdoc/markdown/entities.rb +1 -0
  53. data/lib/rdoc/markdown/{literals_1_9.kpeg → literals.kpeg} +0 -0
  54. data/lib/rdoc/markdown/{literals_1_9.rb → literals.rb} +1 -4
  55. data/lib/rdoc/markup.rb +1 -0
  56. data/lib/rdoc/markup/attr_changer.rb +1 -0
  57. data/lib/rdoc/markup/attr_span.rb +1 -0
  58. data/lib/rdoc/markup/attribute_manager.rb +1 -0
  59. data/lib/rdoc/markup/attributes.rb +1 -0
  60. data/lib/rdoc/markup/blank_line.rb +1 -0
  61. data/lib/rdoc/markup/block_quote.rb +1 -0
  62. data/lib/rdoc/markup/document.rb +1 -0
  63. data/lib/rdoc/markup/formatter.rb +1 -0
  64. data/lib/rdoc/markup/formatter_test_case.rb +1 -4
  65. data/lib/rdoc/markup/hard_break.rb +1 -0
  66. data/lib/rdoc/markup/heading.rb +1 -0
  67. data/lib/rdoc/markup/include.rb +1 -0
  68. data/lib/rdoc/markup/indented_paragraph.rb +1 -0
  69. data/lib/rdoc/markup/inline.rb +1 -0
  70. data/lib/rdoc/markup/list.rb +1 -0
  71. data/lib/rdoc/markup/list_item.rb +1 -0
  72. data/lib/rdoc/markup/paragraph.rb +1 -0
  73. data/lib/rdoc/markup/parser.rb +1 -0
  74. data/lib/rdoc/markup/pre_process.rb +1 -0
  75. data/lib/rdoc/markup/raw.rb +1 -0
  76. data/lib/rdoc/markup/rule.rb +1 -0
  77. data/lib/rdoc/markup/special.rb +1 -0
  78. data/lib/rdoc/markup/text_formatter_test_case.rb +1 -0
  79. data/lib/rdoc/markup/to_ansi.rb +1 -0
  80. data/lib/rdoc/markup/to_bs.rb +1 -0
  81. data/lib/rdoc/markup/to_html.rb +1 -0
  82. data/lib/rdoc/markup/to_html_crossref.rb +1 -0
  83. data/lib/rdoc/markup/to_html_snippet.rb +1 -0
  84. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -0
  85. data/lib/rdoc/markup/to_label.rb +1 -0
  86. data/lib/rdoc/markup/to_markdown.rb +1 -0
  87. data/lib/rdoc/markup/to_rdoc.rb +1 -0
  88. data/lib/rdoc/markup/to_table_of_contents.rb +1 -0
  89. data/lib/rdoc/markup/to_test.rb +1 -0
  90. data/lib/rdoc/markup/to_tt_only.rb +1 -0
  91. data/lib/rdoc/markup/verbatim.rb +1 -0
  92. data/lib/rdoc/meta_method.rb +1 -0
  93. data/lib/rdoc/method_attr.rb +1 -0
  94. data/lib/rdoc/mixin.rb +1 -0
  95. data/lib/rdoc/normal_class.rb +1 -0
  96. data/lib/rdoc/normal_module.rb +1 -0
  97. data/lib/rdoc/options.rb +1 -0
  98. data/lib/rdoc/parser.rb +1 -0
  99. data/lib/rdoc/parser/c.rb +76 -33
  100. data/lib/rdoc/parser/changelog.rb +7 -1
  101. data/lib/rdoc/parser/markdown.rb +1 -0
  102. data/lib/rdoc/parser/rd.rb +1 -0
  103. data/lib/rdoc/parser/ruby.rb +1 -0
  104. data/lib/rdoc/parser/ruby_tools.rb +1 -0
  105. data/lib/rdoc/parser/simple.rb +1 -0
  106. data/lib/rdoc/parser/text.rb +1 -0
  107. data/lib/rdoc/rd.rb +1 -0
  108. data/lib/rdoc/rd/inline.rb +1 -0
  109. data/lib/rdoc/rdoc.rb +2 -1
  110. data/lib/rdoc/require.rb +1 -0
  111. data/lib/rdoc/ri.rb +1 -0
  112. data/lib/rdoc/ri/driver.rb +5 -19
  113. data/lib/rdoc/ri/formatter.rb +1 -0
  114. data/lib/rdoc/ri/paths.rb +1 -0
  115. data/lib/rdoc/ri/store.rb +1 -0
  116. data/lib/rdoc/ri/task.rb +72 -0
  117. data/lib/rdoc/ruby_lex.rb +11 -17
  118. data/lib/rdoc/ruby_token.rb +1 -0
  119. data/lib/rdoc/rubygems_hook.rb +1 -0
  120. data/lib/rdoc/servlet.rb +4 -3
  121. data/lib/rdoc/single_class.rb +1 -0
  122. data/lib/rdoc/stats.rb +1 -0
  123. data/lib/rdoc/stats/normal.rb +1 -0
  124. data/lib/rdoc/stats/quiet.rb +1 -0
  125. data/lib/rdoc/stats/verbose.rb +1 -0
  126. data/lib/rdoc/store.rb +3 -9
  127. data/lib/rdoc/task.rb +1 -0
  128. data/lib/rdoc/test_case.rb +1 -10
  129. data/lib/rdoc/text.rb +1 -0
  130. data/lib/rdoc/token_stream.rb +1 -0
  131. data/lib/rdoc/tom_doc.rb +1 -0
  132. data/lib/rdoc/top_level.rb +1 -0
  133. data/rdoc.gemspec +60 -0
  134. metadata +32 -155
  135. data/Manifest.txt +0 -309
  136. data/lib/rdoc/markdown/literals_1_8.kpeg +0 -18
  137. data/lib/rdoc/markdown/literals_1_8.rb +0 -416
  138. data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +0 -21
  139. data/test/MarkdownTest_1.0.3/Auto links.text +0 -13
  140. data/test/MarkdownTest_1.0.3/Backslash escapes.text +0 -120
  141. data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +0 -11
  142. data/test/MarkdownTest_1.0.3/Code Blocks.text +0 -14
  143. data/test/MarkdownTest_1.0.3/Code Spans.text +0 -6
  144. data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +0 -8
  145. data/test/MarkdownTest_1.0.3/Horizontal rules.text +0 -67
  146. data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +0 -15
  147. data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +0 -69
  148. data/test/MarkdownTest_1.0.3/Inline HTML comments.text +0 -13
  149. data/test/MarkdownTest_1.0.3/Links, inline style.text +0 -12
  150. data/test/MarkdownTest_1.0.3/Links, reference style.text +0 -71
  151. data/test/MarkdownTest_1.0.3/Links, shortcut references.text +0 -20
  152. data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +0 -7
  153. data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +0 -306
  154. data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +0 -888
  155. data/test/MarkdownTest_1.0.3/Nested blockquotes.text +0 -5
  156. data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +0 -131
  157. data/test/MarkdownTest_1.0.3/Strong and em together.text +0 -7
  158. data/test/MarkdownTest_1.0.3/Tabs.text +0 -21
  159. data/test/MarkdownTest_1.0.3/Tidyness.text +0 -5
  160. data/test/README +0 -1
  161. data/test/binary.dat +0 -0
  162. data/test/hidden.zip.txt +0 -1
  163. data/test/test.ja.largedoc +0 -3
  164. data/test/test.ja.rdoc +0 -10
  165. data/test/test.ja.txt +0 -8
  166. data/test/test.txt +0 -1
  167. data/test/test_rdoc_alias.rb +0 -13
  168. data/test/test_rdoc_any_method.rb +0 -460
  169. data/test/test_rdoc_attr.rb +0 -190
  170. data/test/test_rdoc_class_module.rb +0 -1492
  171. data/test/test_rdoc_code_object.rb +0 -450
  172. data/test/test_rdoc_comment.rb +0 -504
  173. data/test/test_rdoc_constant.rb +0 -181
  174. data/test/test_rdoc_context.rb +0 -901
  175. data/test/test_rdoc_context_section.rb +0 -130
  176. data/test/test_rdoc_cross_reference.rb +0 -192
  177. data/test/test_rdoc_encoding.rb +0 -227
  178. data/test/test_rdoc_extend.rb +0 -94
  179. data/test/test_rdoc_generator_darkfish.rb +0 -229
  180. data/test/test_rdoc_generator_json_index.rb +0 -324
  181. data/test/test_rdoc_generator_markup.rb +0 -59
  182. data/test/test_rdoc_generator_pot.rb +0 -91
  183. data/test/test_rdoc_generator_pot_po.rb +0 -51
  184. data/test/test_rdoc_generator_pot_po_entry.rb +0 -139
  185. data/test/test_rdoc_generator_ri.rb +0 -78
  186. data/test/test_rdoc_i18n_locale.rb +0 -73
  187. data/test/test_rdoc_i18n_text.rb +0 -123
  188. data/test/test_rdoc_include.rb +0 -108
  189. data/test/test_rdoc_markdown.rb +0 -980
  190. data/test/test_rdoc_markdown_test.rb +0 -1884
  191. data/test/test_rdoc_markup.rb +0 -95
  192. data/test/test_rdoc_markup_attribute_manager.rb +0 -364
  193. data/test/test_rdoc_markup_attributes.rb +0 -39
  194. data/test/test_rdoc_markup_document.rb +0 -207
  195. data/test/test_rdoc_markup_formatter.rb +0 -175
  196. data/test/test_rdoc_markup_hard_break.rb +0 -31
  197. data/test/test_rdoc_markup_heading.rb +0 -29
  198. data/test/test_rdoc_markup_include.rb +0 -19
  199. data/test/test_rdoc_markup_indented_paragraph.rb +0 -53
  200. data/test/test_rdoc_markup_paragraph.rb +0 -32
  201. data/test/test_rdoc_markup_parser.rb +0 -1680
  202. data/test/test_rdoc_markup_pre_process.rb +0 -473
  203. data/test/test_rdoc_markup_raw.rb +0 -22
  204. data/test/test_rdoc_markup_to_ansi.rb +0 -369
  205. data/test/test_rdoc_markup_to_bs.rb +0 -366
  206. data/test/test_rdoc_markup_to_html.rb +0 -662
  207. data/test/test_rdoc_markup_to_html_crossref.rb +0 -225
  208. data/test/test_rdoc_markup_to_html_snippet.rb +0 -711
  209. data/test/test_rdoc_markup_to_joined_paragraph.rb +0 -32
  210. data/test/test_rdoc_markup_to_label.rb +0 -112
  211. data/test/test_rdoc_markup_to_markdown.rb +0 -389
  212. data/test/test_rdoc_markup_to_rdoc.rb +0 -377
  213. data/test/test_rdoc_markup_to_table_of_contents.rb +0 -126
  214. data/test/test_rdoc_markup_to_tt_only.rb +0 -246
  215. data/test/test_rdoc_markup_verbatim.rb +0 -29
  216. data/test/test_rdoc_method_attr.rb +0 -193
  217. data/test/test_rdoc_normal_class.rb +0 -47
  218. data/test/test_rdoc_normal_module.rb +0 -42
  219. data/test/test_rdoc_options.rb +0 -766
  220. data/test/test_rdoc_parser.rb +0 -327
  221. data/test/test_rdoc_parser_c.rb +0 -1896
  222. data/test/test_rdoc_parser_changelog.rb +0 -315
  223. data/test/test_rdoc_parser_markdown.rb +0 -61
  224. data/test/test_rdoc_parser_rd.rb +0 -55
  225. data/test/test_rdoc_parser_ruby.rb +0 -3322
  226. data/test/test_rdoc_parser_simple.rb +0 -115
  227. data/test/test_rdoc_rd.rb +0 -30
  228. data/test/test_rdoc_rd_block_parser.rb +0 -535
  229. data/test/test_rdoc_rd_inline.rb +0 -63
  230. data/test/test_rdoc_rd_inline_parser.rb +0 -177
  231. data/test/test_rdoc_rdoc.rb +0 -455
  232. data/test/test_rdoc_require.rb +0 -25
  233. data/test/test_rdoc_ri_driver.rb +0 -1436
  234. data/test/test_rdoc_ri_paths.rb +0 -155
  235. data/test/test_rdoc_ruby_lex.rb +0 -421
  236. data/test/test_rdoc_ruby_token.rb +0 -19
  237. data/test/test_rdoc_rubygems_hook.rb +0 -251
  238. data/test/test_rdoc_servlet.rb +0 -534
  239. data/test/test_rdoc_single_class.rb +0 -20
  240. data/test/test_rdoc_stats.rb +0 -722
  241. data/test/test_rdoc_store.rb +0 -993
  242. data/test/test_rdoc_task.rb +0 -173
  243. data/test/test_rdoc_text.rb +0 -557
  244. data/test/test_rdoc_token_stream.rb +0 -42
  245. data/test/test_rdoc_tom_doc.rb +0 -520
  246. data/test/test_rdoc_top_level.rb +0 -287
  247. data/test/xref_data.rb +0 -76
  248. data/test/xref_test_case.rb +0 -67
@@ -1,173 +0,0 @@
1
- require 'rdoc/test_case'
2
- begin
3
- require 'rake'
4
- rescue LoadError
5
- end
6
-
7
- class TestRDocTask < RDoc::TestCase
8
-
9
- def setup
10
- super
11
-
12
- Rake::Task.clear
13
-
14
- @t = RDoc::Task.new
15
- end
16
-
17
- def test_clobber_task_description
18
- assert_equal 'Remove RDoc HTML files', @t.clobber_task_description
19
- end
20
-
21
- def test_inline_source
22
- _, err = verbose_capture_io do
23
- assert @t.inline_source
24
- end
25
-
26
- assert_equal "RDoc::Task#inline_source is deprecated\n", err
27
-
28
- _, err = verbose_capture_io do
29
- @t.inline_source = false
30
- end
31
-
32
- assert_equal "RDoc::Task#inline_source is deprecated\n", err
33
-
34
- capture_io do
35
- assert @t.inline_source
36
- end
37
- end
38
-
39
- def test_markup_option
40
- rdoc_task = RDoc::Task.new do |rd|
41
- rd.markup = "tomdoc"
42
- end
43
-
44
- assert_equal %w[-o html --markup tomdoc], rdoc_task.option_list
45
- end
46
-
47
- def test_tasks_creation
48
- RDoc::Task.new
49
- assert Rake::Task[:rdoc]
50
- assert Rake::Task[:clobber_rdoc]
51
- assert Rake::Task[:rerdoc]
52
- assert_equal ["html/created.rid"], Rake::Task[:rdoc].prerequisites
53
- end
54
-
55
- def test_tasks_creation_with_custom_name_symbol
56
- rd = RDoc::Task.new(:rdoc_dev)
57
- assert Rake::Task[:rdoc_dev]
58
- assert Rake::Task[:clobber_rdoc_dev]
59
- assert Rake::Task[:rerdoc_dev]
60
- assert_equal :rdoc_dev, rd.name
61
- end
62
-
63
- def test_tasks_option_parser
64
- rdoc_task = RDoc::Task.new do |rd|
65
- rd.title = "Test Tasks Option Parser"
66
- rd.main = "README.md"
67
- rd.rdoc_files.include("README.md")
68
- rd.options << "--all"
69
- end
70
-
71
- assert rdoc_task.title, "Test Tasks Option Parser"
72
- assert rdoc_task.main, "README.md"
73
- assert rdoc_task.rdoc_files.include?("README.md")
74
- assert rdoc_task.options.include?("--all")
75
-
76
- args = %w[--all -o html --main README.md] << "--title" << "Test Tasks Option Parser" << "README.md"
77
- assert_equal args, rdoc_task.option_list + rdoc_task.rdoc_files
78
- end
79
-
80
- def test_generator_option
81
- rdoc_task = RDoc::Task.new do |rd|
82
- rd.generator = "ri"
83
- end
84
-
85
- assert_equal %w[-o html -f ri], rdoc_task.option_list
86
- end
87
-
88
- def test_main_option
89
- rdoc_task = RDoc::Task.new do |rd|
90
- rd.main = "README.md"
91
- end
92
-
93
- assert_equal %w[-o html --main README.md], rdoc_task.option_list
94
- end
95
-
96
- def test_output_dir_option
97
- rdoc_task = RDoc::Task.new do |rd|
98
- rd.rdoc_dir = "zomg"
99
- end
100
-
101
- assert_equal %w[-o zomg], rdoc_task.option_list
102
- end
103
-
104
- def test_rdoc_task_description
105
- assert_equal 'Build RDoc HTML files', @t.rdoc_task_description
106
- end
107
-
108
- def test_rerdoc_task_description
109
- assert_equal 'Rebuild RDoc HTML files', @t.rerdoc_task_description
110
- end
111
-
112
- def test_tasks_creation_with_custom_name_string
113
- rd = RDoc::Task.new("rdoc_dev")
114
- assert Rake::Task[:rdoc_dev]
115
- assert Rake::Task[:clobber_rdoc_dev]
116
- assert Rake::Task[:rerdoc_dev]
117
- assert_equal "rdoc_dev", rd.name
118
- end
119
-
120
- def test_tasks_creation_with_custom_name_hash
121
- options = {
122
- :rdoc => "rdoc",
123
- :clobber_rdoc => "rdoc:clean",
124
- :rerdoc => "rdoc:force"
125
- }
126
-
127
- Rake::Task.clear
128
-
129
- rd = RDoc::Task.new(options)
130
- assert Rake::Task[:"rdoc"]
131
- assert Rake::Task[:"rdoc:clean"]
132
- assert Rake::Task[:"rdoc:force"]
133
- assert_raises(RuntimeError) { Rake::Task[:clobber_rdoc] }
134
- assert_equal options, rd.name
135
- end
136
-
137
- def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
138
- RDoc::Task.new(:clobber_rdoc => "rdoc:clean")
139
- assert Rake::Task[:rdoc]
140
- assert Rake::Task[:"rdoc:clean"]
141
- assert Rake::Task[:rerdoc]
142
- end
143
-
144
- def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
145
- assert_raises(ArgumentError) do
146
- RDoc::Task.new(:foo => "bar")
147
- end
148
-
149
- begin
150
- RDoc::Task.new(:foo => "bar")
151
- rescue ArgumentError => e
152
- assert_match(/foo/, e.message)
153
- end
154
- end
155
-
156
- def test_template_option
157
- rdoc_task = RDoc::Task.new do |rd|
158
- rd.template = "foo"
159
- end
160
-
161
- assert_equal %w[-o html -T foo], rdoc_task.option_list
162
- end
163
-
164
- def test_title_option
165
- rdoc_task = RDoc::Task.new do |rd|
166
- rd.title = "Test Title Option"
167
- end
168
-
169
- assert_equal %w[-o html] << "--title" << "Test Title Option", rdoc_task.option_list
170
- end
171
-
172
- end if defined?(Rake::Task)
173
-
@@ -1,557 +0,0 @@
1
- # coding: utf-8
2
-
3
- require 'rdoc/test_case'
4
-
5
- class TestRDocText < RDoc::TestCase
6
-
7
- include RDoc::Text
8
-
9
- def setup
10
- super
11
-
12
- @options = RDoc::Options.new
13
-
14
- @top_level = @store.add_file 'file.rb'
15
- end
16
-
17
- def test_self_encode_fallback
18
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
19
-
20
- assert_equal '…',
21
- RDoc::Text::encode_fallback('…', Encoding::UTF_8, '...')
22
- assert_equal '...',
23
- RDoc::Text::encode_fallback('…', Encoding::US_ASCII, '...')
24
- end
25
-
26
- def test_expand_tabs
27
- assert_equal("hello\n dave",
28
- expand_tabs("hello\n dave"), 'spaces')
29
-
30
- assert_equal("hello\n dave",
31
- expand_tabs("hello\n\tdave"), 'tab')
32
-
33
- assert_equal("hello\n dave",
34
- expand_tabs("hello\n \tdave"), '1 space tab')
35
-
36
- assert_equal("hello\n dave",
37
- expand_tabs("hello\n \tdave"), '2 space tab')
38
-
39
- assert_equal("hello\n dave",
40
- expand_tabs("hello\n \tdave"), '3 space tab')
41
-
42
- assert_equal("hello\n dave",
43
- expand_tabs("hello\n \tdave"), '4 space tab')
44
-
45
- assert_equal("hello\n dave",
46
- expand_tabs("hello\n \tdave"), '5 space tab')
47
-
48
- assert_equal("hello\n dave",
49
- expand_tabs("hello\n \tdave"), '6 space tab')
50
-
51
- assert_equal("hello\n dave",
52
- expand_tabs("hello\n \tdave"), '7 space tab')
53
-
54
- assert_equal("hello\n dave",
55
- expand_tabs("hello\n \tdave"), '8 space tab')
56
-
57
- assert_equal('. .',
58
- expand_tabs(".\t\t."), 'dot tab tab dot')
59
-
60
- assert_equal('a a',
61
- Timeout.timeout(1) {expand_tabs("\ra\ta")}, "carriage return")
62
- end
63
-
64
- def test_expand_tabs_encoding
65
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
66
-
67
- inn = "hello\ns\tdave"
68
- inn.force_encoding Encoding::BINARY
69
-
70
- out = expand_tabs inn
71
-
72
- assert_equal "hello\ns dave", out
73
- assert_equal Encoding::BINARY, out.encoding
74
- end
75
-
76
- def test_flush_left
77
- text = <<-TEXT
78
-
79
- we don't worry too much.
80
-
81
- The comments associated with
82
- TEXT
83
-
84
- expected = <<-EXPECTED
85
-
86
- we don't worry too much.
87
-
88
- The comments associated with
89
- EXPECTED
90
-
91
- assert_equal expected, flush_left(text)
92
- end
93
-
94
- def test_flush_left_encoding
95
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
96
-
97
- text = <<-TEXT
98
-
99
- we don't worry too much.
100
-
101
- The comments associated with
102
- TEXT
103
-
104
- text.force_encoding Encoding::US_ASCII
105
-
106
- expected = <<-EXPECTED
107
-
108
- we don't worry too much.
109
-
110
- The comments associated with
111
- EXPECTED
112
-
113
- result = flush_left text
114
-
115
- assert_equal expected, result
116
- assert_equal Encoding::US_ASCII, result.encoding
117
- end
118
-
119
- def test_markup_string
120
- out = markup('hi').gsub("\n", '')
121
-
122
- assert_equal '<p>hi</p>', out
123
- end
124
-
125
- def test_markup_comment
126
- out = markup(comment('hi')).gsub("\n", '')
127
-
128
- assert_equal '<p>hi</p>', out
129
- end
130
-
131
- def test_normalize_comment_hash
132
- text = <<-TEXT
133
- ##
134
- # we don't worry too much.
135
- #
136
- # The comments associated with
137
- TEXT
138
-
139
- expected = <<-EXPECTED.rstrip
140
- we don't worry too much.
141
-
142
- The comments associated with
143
- EXPECTED
144
-
145
- assert_equal expected, normalize_comment(text)
146
- end
147
-
148
- def test_normalize_comment_stars_single_space
149
- text = <<-TEXT
150
- /*
151
- * we don't worry too much.
152
- *
153
- * The comments associated with
154
- */
155
- TEXT
156
-
157
- expected = <<-EXPECTED.rstrip
158
- we don't worry too much.
159
-
160
- The comments associated with
161
- EXPECTED
162
-
163
- assert_equal expected, normalize_comment(text)
164
- end
165
-
166
- def test_normalize_comment_stars_single_double_space
167
- text = <<-TEXT
168
- /*
169
- * we don't worry too much.
170
- *
171
- * The comments associated with
172
- */
173
- TEXT
174
-
175
- expected = <<-EXPECTED.rstrip
176
- we don't worry too much.
177
-
178
- The comments associated with
179
- EXPECTED
180
-
181
- assert_equal expected, normalize_comment(text)
182
- end
183
-
184
- def test_parse
185
- assert_kind_of RDoc::Markup::Document, parse('hi')
186
- end
187
-
188
- def test_parse_comment
189
- expected = RDoc::Markup::Document.new
190
- expected.file = @top_level
191
-
192
- c = comment ''
193
- parsed = parse c
194
-
195
- assert_equal expected, parsed
196
- assert_same parsed, parse(c)
197
- end
198
-
199
- def test_parse_document
200
- assert_equal RDoc::Markup::Document.new, parse(RDoc::Markup::Document.new)
201
- end
202
-
203
- def test_parse_empty
204
- assert_equal RDoc::Markup::Document.new, parse('')
205
- end
206
-
207
- def test_parse_empty_newline
208
- assert_equal RDoc::Markup::Document.new, parse("#\n")
209
- end
210
-
211
- def test_parse_format_markdown
212
- expected =
213
- @RM::Document.new(
214
- @RM::Paragraph.new('it _works_'))
215
-
216
- parsed = parse 'it *works*', 'markdown'
217
-
218
- assert_equal expected, parsed
219
- end
220
-
221
- def test_parse_format_rd
222
- expected =
223
- @RM::Document.new(
224
- @RM::Paragraph.new('it <em>works</em>'))
225
-
226
- parsed = parse 'it ((*works*))', 'rd'
227
-
228
- assert_equal expected, parsed
229
- end
230
-
231
- def test_parse_format_tomdoc
232
- code = verb('1 + 1')
233
- code.format = :ruby
234
-
235
- expected =
236
- doc(
237
- para('It does a thing'),
238
- blank_line,
239
- head(3, 'Examples'),
240
- blank_line,
241
- code)
242
-
243
- text = <<-TOMDOC
244
- It does a thing
245
-
246
- Examples
247
-
248
- 1 + 1
249
- TOMDOC
250
-
251
- parsed = parse text, 'tomdoc'
252
-
253
- assert_equal expected, parsed
254
- end
255
-
256
- def test_parse_newline
257
- assert_equal RDoc::Markup::Document.new, parse("\n")
258
- end
259
-
260
- def test_snippet
261
- text = <<-TEXT
262
- This is one-hundred characters or more of text in a single paragraph. This
263
- paragraph will be cut off some point after the one-hundredth character.
264
- TEXT
265
-
266
- expected = <<-EXPECTED
267
- <p>This is one-hundred characters or more of text in a single paragraph. This
268
- paragraph will be cut off …
269
- EXPECTED
270
-
271
- assert_equal expected, snippet(text)
272
- end
273
-
274
- def test_snippet_comment
275
- c = comment 'This is a comment'
276
-
277
- assert_equal "<p>This is a comment\n", snippet(c)
278
- end
279
-
280
- def test_snippet_short
281
- text = 'This is a comment'
282
-
283
- assert_equal "<p>#{text}\n", snippet(text)
284
- end
285
-
286
- def test_strip_hashes
287
- text = <<-TEXT
288
- ##
289
- # we don't worry too much.
290
- #
291
- # The comments associated with
292
- TEXT
293
-
294
- expected = <<-EXPECTED
295
-
296
- we don't worry too much.
297
-
298
- The comments associated with
299
- EXPECTED
300
-
301
- assert_equal expected, strip_hashes(text)
302
- end
303
-
304
- def test_strip_hashes_encoding
305
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
306
-
307
- text = <<-TEXT
308
- ##
309
- # we don't worry too much.
310
- #
311
- # The comments associated with
312
- TEXT
313
-
314
- text.force_encoding Encoding::CP852
315
-
316
- expected = <<-EXPECTED
317
-
318
- we don't worry too much.
319
-
320
- The comments associated with
321
- EXPECTED
322
-
323
- stripped = strip_hashes text
324
-
325
- assert_equal expected, stripped
326
- assert_equal Encoding::CP852, stripped.encoding
327
- end
328
-
329
- def test_strip_newlines
330
- assert_equal ' ', strip_newlines("\n \n")
331
-
332
- assert_equal 'hi', strip_newlines("\n\nhi")
333
-
334
- assert_equal 'hi', strip_newlines( "hi\n\n")
335
-
336
- assert_equal 'hi', strip_newlines("\n\nhi\n\n")
337
- end
338
-
339
- def test_strip_newlines_encoding
340
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
341
-
342
- assert_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check'
343
-
344
- text = " \n"
345
- text.force_encoding Encoding::US_ASCII
346
-
347
- stripped = strip_newlines text
348
-
349
- assert_equal ' ', stripped
350
-
351
- assert_equal Encoding::US_ASCII, stripped.encoding
352
- end
353
-
354
- def test_strip_stars
355
- text = <<-TEXT
356
- /*
357
- * * we don't worry too much.
358
- *
359
- * The comments associated with
360
- */
361
- TEXT
362
-
363
- expected = <<-EXPECTED
364
-
365
- * we don't worry too much.
366
-
367
- The comments associated with
368
- EXPECTED
369
-
370
- assert_equal expected, strip_stars(text)
371
- end
372
-
373
- def test_strip_stars_document_method
374
- text = <<-TEXT
375
- /*
376
- * Document-method: Zlib::GzipFile#mtime=
377
- *
378
- * A comment
379
- */
380
- TEXT
381
-
382
- expected = <<-EXPECTED
383
-
384
- A comment
385
- EXPECTED
386
-
387
- assert_equal expected, strip_stars(text)
388
- end
389
-
390
- def test_strip_stars_encoding
391
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
392
-
393
- text = <<-TEXT
394
- /*
395
- * * we don't worry too much.
396
- *
397
- * The comments associated with
398
- */
399
- TEXT
400
-
401
- text.force_encoding Encoding::CP852
402
-
403
- expected = <<-EXPECTED
404
-
405
- * we don't worry too much.
406
-
407
- The comments associated with
408
- EXPECTED
409
-
410
- result = strip_stars text
411
-
412
- assert_equal expected, result
413
- assert_equal Encoding::CP852, result.encoding
414
- end
415
-
416
- def test_strip_stars_encoding2
417
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
418
-
419
- text = <<-TEXT
420
- /*
421
- * * we don't worry too much.
422
- *
423
- * The comments associated with
424
- */
425
- TEXT
426
-
427
- text.force_encoding Encoding::BINARY
428
-
429
- expected = <<-EXPECTED
430
-
431
- * we don't worry too much.
432
-
433
- The comments associated with
434
- EXPECTED
435
-
436
- result = strip_stars text
437
-
438
- assert_equal expected, result
439
- assert_equal Encoding::BINARY, result.encoding
440
- end
441
-
442
- def test_strip_stars_no_stars
443
- text = <<-TEXT
444
- * we don't worry too much.
445
-
446
- The comments associated with
447
-
448
- TEXT
449
-
450
- expected = <<-EXPECTED
451
- * we don't worry too much.
452
-
453
- The comments associated with
454
-
455
- EXPECTED
456
-
457
- assert_equal expected, strip_stars(text)
458
- end
459
-
460
- def test_to_html_apostrophe
461
- assert_equal '‘a', to_html("'a")
462
- assert_equal 'a’', to_html("a'")
463
-
464
- assert_equal '‘a’ ‘', to_html("'a' '")
465
- end
466
-
467
- def test_to_html_backslash
468
- assert_equal 'S', to_html('\\S')
469
- end
470
-
471
- def test_to_html_br
472
- assert_equal '<br>', to_html('<br>')
473
- end
474
-
475
- def test_to_html_copyright
476
- assert_equal '©', to_html('(c)')
477
- end
478
-
479
- def test_to_html_dash
480
- assert_equal '-', to_html('-')
481
- assert_equal '–', to_html('--')
482
- assert_equal '—', to_html('---')
483
- assert_equal '—-', to_html('----')
484
- end
485
-
486
- def test_to_html_double_backtick
487
- assert_equal '“a', to_html('``a')
488
- assert_equal '“a“', to_html('``a``')
489
- end
490
-
491
- def test_to_html_double_quote
492
- assert_equal '“a', to_html('"a')
493
- assert_equal '“a”', to_html('"a"')
494
- end
495
-
496
- def test_to_html_double_quote_quot
497
- assert_equal '“a', to_html('&quot;a')
498
- assert_equal '“a”', to_html('&quot;a&quot;')
499
- end
500
-
501
- def test_to_html_double_tick
502
- assert_equal '”a', to_html("''a")
503
- assert_equal '”a”', to_html("''a''")
504
- end
505
-
506
- def test_to_html_ellipsis
507
- assert_equal '..', to_html('..')
508
- assert_equal '…', to_html('...')
509
- assert_equal '.…', to_html('....')
510
- end
511
-
512
- def test_to_html_encoding
513
- skip "Encoding not implemented" unless Object.const_defined? :Encoding
514
-
515
- s = '...(c)'.encode Encoding::Shift_JIS
516
-
517
- html = to_html s
518
-
519
- assert_equal Encoding::Shift_JIS, html.encoding
520
-
521
- expected = '…(c)'.encode Encoding::Shift_JIS
522
-
523
- assert_equal expected, html
524
- end
525
-
526
- def test_to_html_html_tag
527
- assert_equal '<a href="http://example">hi’s</a>',
528
- to_html('<a href="http://example">hi\'s</a>')
529
- end
530
-
531
- def test_to_html_registered_trademark
532
- assert_equal '®', to_html('(r)')
533
- end
534
-
535
- def test_to_html_tt_tag
536
- assert_equal '<tt>hi\'s</tt>', to_html('<tt>hi\'s</tt>')
537
- assert_equal '<tt>hi\\\'s</tt>', to_html('<tt>hi\\\\\'s</tt>')
538
- end
539
-
540
- def test_to_html_tt_tag_mismatch
541
- _, err = verbose_capture_io do
542
- assert_equal '<tt>hi', to_html('<tt>hi')
543
- end
544
-
545
- assert_equal "mismatched <tt> tag\n", err
546
- end
547
-
548
- def formatter
549
- RDoc::Markup::ToHtml.new @options
550
- end
551
-
552
- def options
553
- @options
554
- end
555
-
556
- end
557
-