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,123 +0,0 @@
1
- require 'rdoc/test_case'
2
-
3
- class TestRDocI18nText < RDoc::TestCase
4
-
5
- def test_multiple_paragraphs
6
- paragraph1 = <<-PARAGRAPH.strip
7
- RDoc produces HTML and command-line documentation for Ruby projects. RDoc
8
- includes the +rdoc+ and +ri+ tools for generating and displaying documentation
9
- from the command-line.
10
- PARAGRAPH
11
-
12
- paragraph2 = <<-PARAGRAPH.strip
13
- This command generates documentation for all the Ruby and C source
14
- files in and below the current directory. These will be stored in a
15
- documentation tree starting in the subdirectory +doc+.
16
- PARAGRAPH
17
-
18
- raw = <<-RAW
19
- #{paragraph1}
20
-
21
- #{paragraph2}
22
- RAW
23
-
24
- expected = [
25
- {
26
- :type => :paragraph,
27
- :paragraph => paragraph1,
28
- :line_no => 1,
29
- },
30
- {
31
- :type => :paragraph,
32
- :paragraph => paragraph2,
33
- :line_no => 5,
34
- },
35
- ]
36
- assert_equal expected, extract_messages(raw)
37
- end
38
-
39
- def test_translate_multiple_paragraphs
40
- paragraph1 = <<-PARAGRAPH.strip
41
- Paragraph 1.
42
- PARAGRAPH
43
- paragraph2 = <<-PARAGRAPH.strip
44
- Paragraph 2.
45
- PARAGRAPH
46
-
47
- raw = <<-RAW
48
- #{paragraph1}
49
-
50
- #{paragraph2}
51
- RAW
52
-
53
- expected = <<-TRANSLATED
54
- Paragraphe 1.
55
-
56
- Paragraphe 2.
57
- TRANSLATED
58
- assert_equal expected, translate(raw)
59
- end
60
-
61
- def test_translate_not_transalted_message
62
- nonexistent_paragraph = <<-PARAGRAPH.strip
63
- Nonexistent paragraph.
64
- PARAGRAPH
65
-
66
- raw = <<-RAW
67
- #{nonexistent_paragraph}
68
- RAW
69
-
70
- expected = <<-TRANSLATED
71
- #{nonexistent_paragraph}
72
- TRANSLATED
73
- assert_equal expected, translate(raw)
74
- end
75
-
76
- def test_translate_keep_empty_lines
77
- raw = <<-RAW
78
- Paragraph 1.
79
-
80
-
81
-
82
-
83
- Paragraph 2.
84
- RAW
85
-
86
- expected = <<-TRANSLATED
87
- Paragraphe 1.
88
-
89
-
90
-
91
-
92
- Paragraphe 2.
93
- TRANSLATED
94
- assert_equal expected, translate(raw)
95
- end
96
-
97
- private
98
-
99
- def extract_messages(raw)
100
- text = RDoc::I18n::Text.new(raw)
101
- messages = []
102
- text.extract_messages do |message|
103
- messages << message
104
- end
105
- messages
106
- end
107
-
108
- def locale
109
- locale = RDoc::I18n::Locale.new('fr')
110
- messages = locale.instance_variable_get(:@messages)
111
- messages['markdown'] = 'markdown (markdown in fr)'
112
- messages['Hello'] = 'Bonjour (Hello in fr)'
113
- messages['Paragraph 1.'] = 'Paragraphe 1.'
114
- messages['Paragraph 2.'] = 'Paragraphe 2.'
115
- locale
116
- end
117
-
118
- def translate(raw)
119
- text = RDoc::I18n::Text.new(raw)
120
- text.translate(locale)
121
- end
122
-
123
- end
@@ -1,108 +0,0 @@
1
- require File.expand_path '../xref_test_case', __FILE__
2
-
3
- class TestRDocInclude < XrefTestCase
4
-
5
- def setup
6
- super
7
-
8
- @inc = RDoc::Include.new 'M1', 'comment'
9
- @inc.parent = @m1
10
- @inc.record_location @top_level
11
- @inc.store = @store
12
- end
13
-
14
- def test_module
15
- assert_equal @m1, @inc.module
16
- assert_equal 'Unknown', RDoc::Include.new('Unknown', 'comment').module
17
- end
18
-
19
- def test_module_extended
20
- m1 = @xref_data.add_module RDoc::NormalModule, 'Mod1'
21
- m1_m3 = m1.add_module RDoc::NormalModule, 'Mod3'
22
- m1_m2 = m1.add_module RDoc::NormalModule, 'Mod2'
23
- m1_m2_m3 = m1_m2.add_module RDoc::NormalModule, 'Mod3'
24
- m1_m2_m3_m4 = m1_m2_m3.add_module RDoc::NormalModule, 'Mod4'
25
- m1_m2_m4 = m1_m2.add_module RDoc::NormalModule, 'Mod4'
26
- m1_m2_k0 = m1_m2.add_class RDoc::NormalClass, 'Klass0'
27
- m1_m2_k0_m4 = m1_m2_k0.add_module RDoc::NormalModule, 'Mod4'
28
- #m1_m2_k0_m4_m5 = m1_m2_k0_m4.add_module RDoc::NormalModule, 'Mod5'
29
- m1_m2_k0_m4_m6 = m1_m2_k0_m4.add_module RDoc::NormalModule, 'Mod6'
30
- m1_m2_k0_m5 = m1_m2_k0.add_module RDoc::NormalModule, 'Mod5'
31
-
32
- i0_m4 = RDoc::Include.new 'Mod4', nil
33
- i0_m5 = RDoc::Include.new 'Mod5', nil
34
- i0_m6 = RDoc::Include.new 'Mod6', nil
35
- i0_m1 = RDoc::Include.new 'Mod1', nil
36
- i0_m2 = RDoc::Include.new 'Mod2', nil
37
- i0_m3 = RDoc::Include.new 'Mod3', nil
38
-
39
- m1_m2_k0.add_include i0_m4
40
- m1_m2_k0.add_include i0_m5
41
- m1_m2_k0.add_include i0_m6
42
- m1_m2_k0.add_include i0_m1
43
- m1_m2_k0.add_include i0_m2
44
- m1_m2_k0.add_include i0_m3
45
-
46
- assert_equal [i0_m4, i0_m5, i0_m6, i0_m1, i0_m2, i0_m3], m1_m2_k0.includes
47
- assert_equal [m1_m2_m3, m1_m2, m1, m1_m2_k0_m4_m6, m1_m2_k0_m5,
48
- m1_m2_k0_m4, 'Object'], m1_m2_k0.ancestors
49
-
50
- m1_k1 = m1.add_class RDoc::NormalClass, 'Klass1'
51
-
52
- i1_m1 = RDoc::Include.new 'Mod1', nil
53
- i1_m2 = RDoc::Include.new 'Mod2', nil
54
- i1_m3 = RDoc::Include.new 'Mod3', nil
55
- i1_m4 = RDoc::Include.new 'Mod4', nil
56
- i1_k0_m4 = RDoc::Include.new 'Klass0::Mod4', nil
57
-
58
- m1_k1.add_include i1_m1
59
- m1_k1.add_include i1_m2
60
- m1_k1.add_include i1_m3
61
- m1_k1.add_include i1_m4
62
- m1_k1.add_include i1_k0_m4
63
-
64
- assert_equal [i1_m1, i1_m2, i1_m3, i1_m4, i1_k0_m4], m1_k1.includes
65
- assert_equal [m1_m2_k0_m4, m1_m2_m3_m4, m1_m2_m3, m1_m2, m1, 'Object'],
66
- m1_k1.ancestors
67
-
68
- m1_k2 = m1.add_class RDoc::NormalClass, 'Klass2'
69
-
70
- i2_m1 = RDoc::Include.new 'Mod1', nil
71
- i2_m2 = RDoc::Include.new 'Mod2', nil
72
- i2_m3 = RDoc::Include.new 'Mod3', nil
73
- i2_k0_m4 = RDoc::Include.new 'Klass0::Mod4', nil
74
-
75
- m1_k2.add_include i2_m1
76
- m1_k2.add_include i2_m3
77
- m1_k2.add_include i2_m2
78
- m1_k2.add_include i2_k0_m4
79
-
80
- assert_equal [i2_m1, i2_m3, i2_m2, i2_k0_m4], m1_k2.includes
81
- assert_equal [m1_m2_k0_m4, m1_m2, m1_m3, m1, 'Object'], m1_k2.ancestors
82
-
83
- m1_k3 = m1.add_class RDoc::NormalClass, 'Klass3'
84
-
85
- i3_m1 = RDoc::Include.new 'Mod1', nil
86
- i3_m2 = RDoc::Include.new 'Mod2', nil
87
- i3_m4 = RDoc::Include.new 'Mod4', nil
88
-
89
- m1_k3.add_include i3_m1
90
- m1_k3.add_include i3_m2
91
- m1_k3.add_include i3_m4
92
-
93
- assert_equal [i3_m1, i3_m2, i3_m4], m1_k3.includes
94
- assert_equal [m1_m2_m4, m1_m2, m1, 'Object'], m1_k3.ancestors
95
- end
96
-
97
- def test_store_equals
98
- incl = RDoc::Include.new 'M', nil
99
- incl.record_location RDoc::TopLevel.new @top_level.name
100
-
101
- incl.store = @store
102
-
103
- assert_same @top_level, incl.file
104
- assert_same @store, incl.file.store
105
- end
106
-
107
- end
108
-
@@ -1,980 +0,0 @@
1
- # coding: UTF-8
2
-
3
- require 'rdoc/test_case'
4
- require 'rdoc/markup/block_quote'
5
- require 'rdoc/markdown'
6
-
7
- class TestRDocMarkdown < RDoc::TestCase
8
-
9
- def setup
10
- @RM = RDoc::Markup
11
-
12
- @parser = RDoc::Markdown.new
13
-
14
- @to_html = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
15
- end
16
-
17
- def test_class_parse
18
- doc = RDoc::Markdown.parse "hello\n\nworld"
19
-
20
- expected = doc(para("hello"), para("world"))
21
-
22
- assert_equal expected, doc
23
- end
24
-
25
- def test_emphasis
26
- assert_equal '_word_', @parser.emphasis('word')
27
- assert_equal '<em>two words</em>', @parser.emphasis('two words')
28
- assert_equal '<em>*bold*</em>', @parser.emphasis('*bold*')
29
- end
30
-
31
- def test_parse_auto_link_email
32
- doc = parse "Autolink: <nobody-0+_./!%~$@example>"
33
-
34
- expected = doc(para("Autolink: mailto:nobody-0+_./!%~$@example"))
35
-
36
- assert_equal expected, doc
37
- end
38
-
39
- def test_parse_auto_link_url
40
- doc = parse "Autolink: <http://example>"
41
-
42
- expected = doc(para("Autolink: http://example"))
43
-
44
- assert_equal expected, doc
45
- end
46
-
47
- def test_parse_block_quote
48
- doc = parse <<-BLOCK_QUOTE
49
- > this is
50
- > a block quote
51
- BLOCK_QUOTE
52
-
53
- expected =
54
- doc(
55
- block(
56
- para("this is\na block quote")))
57
-
58
- assert_equal expected, doc
59
- end
60
-
61
- def test_parse_block_quote_continue
62
- doc = parse <<-BLOCK_QUOTE
63
- > this is
64
- a block quote
65
- BLOCK_QUOTE
66
-
67
- expected =
68
- doc(
69
- block(
70
- para("this is\na block quote")))
71
-
72
- assert_equal expected, doc
73
- end
74
-
75
- def test_parse_block_quote_list
76
- doc = parse <<-BLOCK_QUOTE
77
- > text
78
- >
79
- > * one
80
- > * two
81
- BLOCK_QUOTE
82
-
83
- expected =
84
- doc(
85
- block(
86
- para("text"),
87
- list(:BULLET,
88
- item(nil, para("one")),
89
- item(nil, para("two")))))
90
-
91
- assert_equal expected, doc
92
- end
93
-
94
- def test_parse_block_quote_newline
95
- doc = parse <<-BLOCK_QUOTE
96
- > this is
97
- a block quote
98
-
99
- BLOCK_QUOTE
100
-
101
- expected =
102
- doc(
103
- block(
104
- para("this is\na block quote")))
105
-
106
- assert_equal expected, doc
107
- end
108
-
109
- def test_parse_block_quote_separate
110
- doc = parse <<-BLOCK_QUOTE
111
- > this is
112
- a block quote
113
-
114
- > that continues
115
- BLOCK_QUOTE
116
-
117
- expected =
118
- doc(
119
- block(
120
- para("this is\na block quote"),
121
- para("that continues")))
122
-
123
- assert_equal expected, doc
124
- end
125
-
126
- def test_parse_char_entity
127
- doc = parse '&pi; &nn;'
128
-
129
- expected = doc(para('π &nn;'))
130
-
131
- assert_equal expected, doc
132
- end
133
-
134
- def test_parse_code
135
- doc = parse "Code: `text`"
136
-
137
- expected = doc(para("Code: <code>text</code>"))
138
-
139
- assert_equal expected, doc
140
- end
141
-
142
- def test_parse_code_github
143
- doc = parse <<-MD
144
- Example:
145
-
146
- ```
147
- code goes here
148
- ```
149
- MD
150
-
151
- expected =
152
- doc(
153
- para("Example:"),
154
- verb("code goes here\n"))
155
-
156
- assert_equal expected, doc
157
- end
158
-
159
- def test_parse_code_github_format
160
- doc = parse <<-MD
161
- Example:
162
-
163
- ``` ruby
164
- code goes here
165
- ```
166
- MD
167
-
168
- code = verb("code goes here\n")
169
- code.format = :ruby
170
-
171
- expected =
172
- doc(
173
- para("Example:"),
174
- code)
175
-
176
- assert_equal expected, doc
177
- end
178
-
179
- def test_parse_definition_list
180
- doc = parse <<-MD
181
- one
182
- : This is a definition
183
-
184
- two
185
- : This is another definition
186
- MD
187
-
188
- expected = doc(
189
- list(:NOTE,
190
- item(%w[one], para("This is a definition")),
191
- item(%w[two], para("This is another definition"))))
192
-
193
- assert_equal expected, doc
194
- end
195
-
196
- def test_parse_definition_list_indents
197
- doc = parse <<-MD
198
- zero
199
- : Indented zero characters
200
-
201
- one
202
- : Indented one characters
203
-
204
- two
205
- : Indented two characters
206
-
207
- three
208
- : Indented three characters
209
-
210
- four
211
- : Indented four characters
212
-
213
- MD
214
-
215
- expected = doc(
216
- list(:NOTE,
217
- item(%w[zero], para("Indented zero characters")),
218
- item(%w[one], para("Indented one characters")),
219
- item(%w[two], para("Indented two characters")),
220
- item(%w[three], para("Indented three characters"))),
221
- para("four\n : Indented four characters"))
222
-
223
- assert_equal expected, doc
224
- end
225
-
226
- def test_parse_definition_list_multi_description
227
- doc = parse <<-MD
228
- label
229
- : This is a definition
230
-
231
- : This is another definition
232
- MD
233
-
234
- expected = doc(
235
- list(:NOTE,
236
- item(%w[label], para("This is a definition")),
237
- item(nil, para("This is another definition"))))
238
-
239
- assert_equal expected, doc
240
- end
241
-
242
- def test_parse_definition_list_multi_label
243
- doc = parse <<-MD
244
- one
245
- two
246
- : This is a definition
247
- MD
248
-
249
- expected = doc(
250
- list(:NOTE,
251
- item(%w[one two], para("This is a definition"))))
252
-
253
- assert_equal expected, doc
254
- end
255
-
256
- def test_parse_definition_list_multi_line
257
- doc = parse <<-MD
258
- one
259
- : This is a definition
260
- that extends to two lines
261
-
262
- two
263
- : This is another definition
264
- that also extends to two lines
265
- MD
266
-
267
- expected = doc(
268
- list(:NOTE,
269
- item(%w[one],
270
- para("This is a definition\nthat extends to two lines")),
271
- item(%w[two],
272
- para("This is another definition\nthat also extends to two lines"))))
273
-
274
- assert_equal expected, doc
275
- end
276
-
277
- def test_parse_definition_list_no
278
- @parser.definition_lists = false
279
-
280
- doc = parse <<-MD
281
- one
282
- : This is a definition
283
-
284
- two
285
- : This is another definition
286
- MD
287
-
288
- expected = doc(
289
- para("one\n: This is a definition"),
290
- para("two\n: This is another definition"))
291
-
292
- assert_equal expected, doc
293
- end
294
-
295
- def test_parse_entity_dec
296
- doc = parse "Entity: &#65;"
297
-
298
- expected = doc(para("Entity: A"))
299
-
300
- assert_equal expected, doc
301
- end
302
-
303
- def test_parse_entity_hex
304
- doc = parse "Entity: &#x41;"
305
-
306
- expected = doc(para("Entity: A"))
307
-
308
- assert_equal expected, doc
309
- end
310
-
311
- def test_parse_entity_named
312
- doc = parse "Entity: &pi;"
313
-
314
- expected = doc(para("Entity: π"))
315
-
316
- assert_equal expected, doc
317
- end
318
-
319
- def test_parse_emphasis_star
320
- doc = parse "it *works*\n"
321
-
322
- expected = @RM::Document.new(
323
- @RM::Paragraph.new("it _works_"))
324
-
325
- assert_equal expected, doc
326
- end
327
-
328
- def test_parse_emphasis_underscore
329
- doc = parse "it _works_\n"
330
-
331
- expected =
332
- doc(
333
- para("it _works_"))
334
-
335
- assert_equal expected, doc
336
- end
337
-
338
- def test_parse_emphasis_underscore_embedded
339
- doc = parse "foo_bar bar_baz\n"
340
-
341
- expected =
342
- doc(
343
- para("foo_bar bar_baz"))
344
-
345
- assert_equal expected, doc
346
- end
347
-
348
- def test_parse_emphasis_underscore_in_word
349
- doc = parse "it foo_bar_baz\n"
350
-
351
- expected =
352
- doc(
353
- para("it foo_bar_baz"))
354
-
355
- assert_equal expected, doc
356
- end
357
-
358
- def test_parse_escape
359
- assert_equal doc(para("Backtick: `")), parse("Backtick: \\`")
360
-
361
- assert_equal doc(para("Backslash: \\")), parse("Backslash: \\\\")
362
-
363
- assert_equal doc(para("Colon: :")), parse("Colon: \\:")
364
- end
365
-
366
- def test_parse_heading_atx
367
- doc = parse "# heading\n"
368
-
369
- expected = @RM::Document.new(
370
- @RM::Heading.new(1, "heading"))
371
-
372
- assert_equal expected, doc
373
- end
374
-
375
- def test_parse_heading_setext_dash
376
- doc = parse <<-MD
377
- heading
378
- ---
379
- MD
380
-
381
- expected = @RM::Document.new(
382
- @RM::Heading.new(2, "heading"))
383
-
384
- assert_equal expected, doc
385
- end
386
-
387
- def test_parse_heading_setext_equals
388
- doc = parse <<-MD
389
- heading
390
- ===
391
- MD
392
-
393
- expected = @RM::Document.new(
394
- @RM::Heading.new(1, "heading"))
395
-
396
- assert_equal expected, doc
397
- end
398
-
399
- def test_parse_html
400
- @parser.html = true
401
-
402
- doc = parse "<address>Links here</address>\n"
403
-
404
- expected = doc(
405
- @RM::Raw.new("<address>Links here</address>"))
406
-
407
- assert_equal expected, doc
408
- end
409
-
410
- def test_parse_html_hr
411
- @parser.html = true
412
-
413
- doc = parse "<hr>\n"
414
-
415
- expected = doc(raw("<hr>"))
416
-
417
- assert_equal expected, doc
418
- end
419
-
420
- def test_parse_html_no_html
421
- @parser.html = false
422
-
423
- doc = parse "<address>Links here</address>\n"
424
-
425
- expected = doc()
426
-
427
- assert_equal expected, doc
428
- end
429
-
430
- def test_parse_image
431
- doc = parse "image ![alt text](path/to/image.jpg)"
432
-
433
- expected = doc(para("image rdoc-image:path/to/image.jpg"))
434
-
435
- assert_equal expected, doc
436
- end
437
-
438
- def test_parse_image_link
439
- @parser.html = true
440
-
441
- doc = parse "[![alt text](path/to/image.jpg)](http://example.com)"
442
-
443
- expected =
444
- doc(
445
- para('{rdoc-image:path/to/image.jpg}[http://example.com]'))
446
-
447
- assert_equal expected, doc
448
- end
449
-
450
- def test_parse_line_break
451
- doc = parse "Some text \nwith extra lines"
452
-
453
- expected = doc(
454
- para("Some text", hard_break, "with extra lines"))
455
-
456
- assert_equal expected, doc
457
- end
458
-
459
- def test_parse_link_reference_id
460
- doc = parse <<-MD
461
- This is [an example][id] reference-style link.
462
-
463
- [id]: http://example.com "Optional Title Here"
464
- MD
465
-
466
- expected = doc(
467
- para("This is {an example}[http://example.com] reference-style link."))
468
-
469
- assert_equal expected, doc
470
- end
471
-
472
- def test_parse_link_reference_id_adjacent
473
- doc = parse <<-MD
474
- [this] [this] should work
475
-
476
- [this]: example
477
- MD
478
-
479
- expected = doc(
480
- para("{this}[example] should work"))
481
-
482
- assert_equal expected, doc
483
- end
484
-
485
- def test_parse_link_reference_id_eof
486
- doc = parse <<-MD.chomp
487
- This is [an example][id] reference-style link.
488
-
489
- [id]: http://example.com "Optional Title Here"
490
- MD
491
-
492
- expected = doc(
493
- para("This is {an example}[http://example.com] reference-style link."))
494
-
495
- assert_equal expected, doc
496
- end
497
-
498
- def test_parse_link_reference_id_many
499
- doc = parse <<-MD
500
- This is [an example][id] reference-style link.
501
-
502
- And [another][id].
503
-
504
- [id]: http://example.com "Optional Title Here"
505
- MD
506
-
507
- expected = doc(
508
- para("This is {an example}[http://example.com] reference-style link."),
509
- para("And {another}[http://example.com]."))
510
-
511
- assert_equal expected, doc
512
- end
513
-
514
- def test_parse_link_reference_implicit
515
- doc = parse <<-MD
516
- This is [an example][] reference-style link.
517
-
518
- [an example]: http://example.com "Optional Title Here"
519
- MD
520
-
521
- expected = doc(
522
- para("This is {an example}[http://example.com] reference-style link."))
523
-
524
- assert_equal expected, doc
525
- end
526
-
527
- def test_parse_list_bullet
528
- doc = parse <<-MD
529
- * one
530
- * two
531
- MD
532
-
533
- expected = doc(
534
- list(:BULLET,
535
- item(nil, para("one")),
536
- item(nil, para("two"))))
537
-
538
- assert_equal expected, doc
539
- end
540
-
541
- def test_parse_list_bullet_auto_link
542
- doc = parse <<-MD
543
- * <http://example/>
544
- MD
545
-
546
- expected = doc(
547
- list(:BULLET,
548
- item(nil, para("http://example/"))))
549
-
550
- assert_equal expected, doc
551
- end
552
-
553
- def test_parse_list_bullet_continue
554
- doc = parse <<-MD
555
- * one
556
-
557
- * two
558
- MD
559
-
560
- expected = doc(
561
- list(:BULLET,
562
- item(nil, para("one")),
563
- item(nil, para("two"))))
564
-
565
- assert_equal expected, doc
566
- end
567
-
568
- def test_parse_list_bullet_multiline
569
- doc = parse <<-MD
570
- * one
571
- two
572
- MD
573
-
574
- expected = doc(
575
- list(:BULLET,
576
- item(nil, para("one\n two"))))
577
-
578
- assert_equal expected, doc
579
- end
580
-
581
- def test_parse_list_bullet_nest
582
- doc = parse <<-MD
583
- * outer
584
- * inner
585
- MD
586
-
587
- expected = doc(
588
- list(:BULLET,
589
- item(nil,
590
- para("outer"),
591
- list(:BULLET,
592
- item(nil,
593
- para("inner"))))))
594
-
595
- assert_equal expected, doc
596
- end
597
-
598
- def test_parse_list_bullet_nest_loose
599
- doc = parse <<-MD
600
- * outer
601
-
602
- * inner
603
- MD
604
-
605
- expected = doc(
606
- list(:BULLET,
607
- item(nil,
608
- para("outer"),
609
- list(:BULLET,
610
- item(nil, para("inner"))))))
611
-
612
- assert_equal expected, doc
613
- end
614
-
615
- def test_parse_list_bullet_nest_continue
616
- doc = parse <<-MD
617
- * outer
618
- * inner
619
- continue inner
620
- * outer 2
621
- MD
622
-
623
- expected = doc(
624
- list(:BULLET,
625
- item(nil,
626
- para("outer"),
627
- list(:BULLET,
628
- item(nil,
629
- para("inner\n continue inner")))),
630
- item(nil,
631
- para("outer 2"))))
632
-
633
- assert_equal expected, doc
634
- end
635
-
636
- def test_parse_list_number
637
- doc = parse <<-MD
638
- 1. one
639
- 1. two
640
- MD
641
-
642
- expected = doc(
643
- list(:NUMBER,
644
- item(nil, para("one")),
645
- item(nil, para("two"))))
646
-
647
- assert_equal expected, doc
648
- end
649
-
650
- def test_parse_list_number_continue
651
- doc = parse <<-MD
652
- 1. one
653
-
654
- 1. two
655
- MD
656
-
657
- expected = doc(
658
- list(:NUMBER,
659
- item(nil, para("one")),
660
- item(nil, para("two"))))
661
-
662
- assert_equal expected, doc
663
- end
664
-
665
- def test_parse_note
666
- @parser.notes = true
667
-
668
- doc = parse <<-MD
669
- Some text.[^1]
670
-
671
- [^1]: With a footnote
672
- MD
673
-
674
- expected = doc(
675
- para("Some text.{*1}[rdoc-label:foottext-1:footmark-1]"),
676
- @RM::Rule.new(1),
677
- para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote"))
678
-
679
- assert_equal expected, doc
680
- end
681
-
682
- def test_parse_note_indent
683
- @parser.notes = true
684
-
685
- doc = parse <<-MD
686
- Some text.[^1]
687
-
688
- [^1]: With a footnote
689
-
690
- more
691
- MD
692
-
693
- expected = doc(
694
- para("Some text.{*1}[rdoc-label:foottext-1:footmark-1]"),
695
- rule(1),
696
- para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote\n\nmore"))
697
-
698
- assert_equal expected, doc
699
- end
700
-
701
- def test_parse_note_inline
702
- @parser.notes = true
703
-
704
- doc = parse <<-MD
705
- Some text. ^[With a footnote]
706
- MD
707
-
708
- expected = doc(
709
- para("Some text. {*1}[rdoc-label:foottext-1:footmark-1]"),
710
- @RM::Rule.new(1),
711
- para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote"))
712
-
713
- assert_equal expected, doc
714
- end
715
-
716
- def test_parse_note_no_notes
717
- @parser.notes = false
718
-
719
- assert_raises RuntimeError do # TODO use a real error
720
- parse "Some text.[^1]"
721
- end
722
- end
723
-
724
- def test_parse_note_multiple
725
- @parser.notes = true
726
-
727
- doc = parse <<-MD
728
- Some text[^1]
729
- with inline notes^[like this]
730
- and an extra note.[^2]
731
-
732
- [^1]: With a footnote
733
-
734
- [^2]: Which should be numbered correctly
735
- MD
736
-
737
- expected = doc(
738
- para("Some text{*1}[rdoc-label:foottext-1:footmark-1]\n" +
739
- "with inline notes{*2}[rdoc-label:foottext-2:footmark-2]\n" +
740
- "and an extra note.{*3}[rdoc-label:foottext-3:footmark-3]"),
741
-
742
- rule(1),
743
-
744
- para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote"),
745
- para("{^2}[rdoc-label:footmark-2:foottext-2] like this"),
746
- para("{^3}[rdoc-label:footmark-3:foottext-3] " +
747
- "Which should be numbered correctly"))
748
-
749
- assert_equal expected, doc
750
- end
751
-
752
- def test_parse_paragraph
753
- doc = parse "it worked\n"
754
-
755
- expected = doc(para("it worked"))
756
-
757
- assert_equal expected, doc
758
- end
759
-
760
- def test_parse_paragraph_break_on_newline
761
- @parser.break_on_newline = true
762
-
763
- doc = parse "one\ntwo\n"
764
-
765
- expected = doc(para("one", hard_break, "two"))
766
-
767
- assert_equal expected, doc
768
-
769
- doc = parse "one \ntwo\nthree\n"
770
-
771
- expected = doc(para("one", hard_break, "two", hard_break, "three"))
772
-
773
- assert_equal expected, doc
774
- end
775
-
776
- def test_parse_paragraph_stars
777
- doc = parse "it worked ****\n"
778
-
779
- expected = @RM::Document.new(
780
- @RM::Paragraph.new("it worked ****"))
781
-
782
- assert_equal expected, doc
783
- end
784
-
785
- def test_parse_paragraph_html
786
- @parser.html = true
787
-
788
- doc = parse "<address>Links here</address>"
789
-
790
- expected = doc(raw("<address>Links here</address>"))
791
-
792
- assert_equal expected, doc
793
- end
794
-
795
- def test_parse_paragraph_html_no_html
796
- @parser.html = false
797
-
798
- doc = parse "<address>Links here</address>"
799
-
800
- expected = doc()
801
-
802
- assert_equal expected, doc
803
- end
804
-
805
- def test_parse_paragraph_indent_one
806
- doc = parse <<-MD
807
- text
808
- MD
809
-
810
- expected = doc(para("text"))
811
-
812
- assert_equal expected, doc
813
- end
814
-
815
- def test_parse_paragraph_indent_two
816
- doc = parse <<-MD
817
- text
818
- MD
819
-
820
- expected = doc(para("text"))
821
-
822
- assert_equal expected, doc
823
- end
824
-
825
- def test_parse_paragraph_indent_three
826
- doc = parse <<-MD
827
- text
828
- MD
829
-
830
- expected = doc(para("text"))
831
-
832
- assert_equal expected, doc
833
- end
834
-
835
- def test_parse_paragraph_multiline
836
- doc = parse "one\ntwo"
837
-
838
- expected = doc(para("one\ntwo"))
839
-
840
- assert_equal expected, doc
841
- end
842
-
843
- def test_parse_paragraph_two
844
- doc = parse "one\n\ntwo"
845
-
846
- expected = @RM::Document.new(
847
- @RM::Paragraph.new("one"),
848
- @RM::Paragraph.new("two"))
849
-
850
- assert_equal expected, doc
851
- end
852
-
853
- def test_parse_plain
854
- doc = parse "it worked"
855
-
856
- expected = @RM::Document.new(
857
- @RM::Paragraph.new("it worked"))
858
-
859
- assert_equal expected, doc
860
- end
861
-
862
- def test_parse_reference_link_embedded_bracket
863
- doc = parse "With [embedded [brackets]] [b].\n\n[b]: /url/\n"
864
-
865
- expected =
866
- doc(
867
- para("With {embedded [brackets]}[/url/]."))
868
-
869
- assert_equal expected, doc
870
- end
871
-
872
- def test_parse_rule_dash
873
- doc = parse "- - -\n\n"
874
-
875
- expected = @RM::Document.new(@RM::Rule.new(1))
876
-
877
- assert_equal expected, doc
878
- end
879
-
880
- def test_parse_rule_underscore
881
- doc = parse "_ _ _\n\n"
882
-
883
- expected = @RM::Document.new(@RM::Rule.new(1))
884
-
885
- assert_equal expected, doc
886
- end
887
-
888
- def test_parse_rule_star
889
- doc = parse "* * *\n\n"
890
-
891
- expected = @RM::Document.new(@RM::Rule.new(1))
892
-
893
- assert_equal expected, doc
894
- end
895
-
896
- def test_parse_strong_star
897
- doc = parse "it **works**\n"
898
-
899
- expected = @RM::Document.new(
900
- @RM::Paragraph.new("it *works*"))
901
-
902
- assert_equal expected, doc
903
- end
904
-
905
- def test_parse_strong_underscore
906
- doc = parse "it __works__\n"
907
-
908
- expected = @RM::Document.new(
909
- @RM::Paragraph.new("it *works*"))
910
-
911
- assert_equal expected, doc
912
- end
913
-
914
- def test_parse_strong_emphasis_star
915
- doc = parse "it ***works***\n"
916
-
917
- expected = @RM::Document.new(
918
- @RM::Paragraph.new("it <b>_works_</b>"))
919
-
920
- assert_equal expected, doc
921
- end
922
-
923
- def test_parse_strong_emphasis_underscore
924
- doc = parse "it ___works___\n"
925
-
926
- expected = @RM::Document.new(
927
- @RM::Paragraph.new("it <b>_works_</b>"))
928
-
929
- assert_equal expected, doc
930
- end
931
-
932
- def test_parse_style
933
- @parser.css = true
934
-
935
- doc = parse "<style>h1 { color: red }</style>\n"
936
-
937
- expected = doc(
938
- @RM::Raw.new("<style>h1 { color: red }</style>"))
939
-
940
- assert_equal expected, doc
941
- end
942
-
943
- def test_parse_style_disabled
944
- doc = parse "<style>h1 { color: red }</style>\n"
945
-
946
- expected = doc()
947
-
948
- assert_equal expected, doc
949
- end
950
-
951
- def test_parse_verbatim
952
- doc = parse <<-MD
953
- text
954
- MD
955
-
956
- expected = doc(verb("text\n"))
957
-
958
- assert_equal expected, doc
959
- end
960
-
961
- def test_parse_verbatim_eof
962
- doc = parse " text"
963
-
964
- expected = doc(verb("text\n"))
965
-
966
- assert_equal expected, doc
967
- end
968
-
969
- def test_strong
970
- assert_equal '*word*', @parser.strong('word')
971
- assert_equal '<b>two words</b>', @parser.strong('two words')
972
- assert_equal '<b>_emphasis_</b>', @parser.strong('_emphasis_')
973
- end
974
-
975
- def parse text
976
- @parser.parse text
977
- end
978
-
979
- end
980
-