rdoc 4.0.1 → 4.1.0.preview.3

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 (140) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +1 -3
  5. data/{DEVELOPERS.rdoc → CONTRIBUTING.rdoc} +28 -3
  6. data/ExampleMarkdown.md +37 -0
  7. data/ExampleRDoc.rdoc +208 -0
  8. data/History.rdoc +81 -0
  9. data/Manifest.txt +11 -2
  10. data/README.rdoc +5 -5
  11. data/Rakefile +34 -4
  12. data/lib/rdoc.rb +4 -3
  13. data/lib/rdoc/any_method.rb +48 -4
  14. data/lib/rdoc/class_module.rb +16 -2
  15. data/lib/rdoc/code_object.rb +85 -24
  16. data/lib/rdoc/comment.rb +0 -3
  17. data/lib/rdoc/constant.rb +9 -1
  18. data/lib/rdoc/context.rb +20 -2
  19. data/lib/rdoc/cross_reference.rb +1 -1
  20. data/lib/rdoc/extend.rb +4 -112
  21. data/lib/rdoc/generator/darkfish.rb +46 -7
  22. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +4 -4
  23. data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -8
  24. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +4 -3
  25. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +3 -3
  26. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +3 -4
  27. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +4 -3
  28. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +3 -4
  29. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +3 -3
  30. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +4 -4
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +9 -5
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -3
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +12 -7
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +5 -4
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +6 -7
  37. data/lib/rdoc/generator/template/darkfish/class.rhtml +36 -41
  38. data/lib/rdoc/generator/template/darkfish/fonts.css +167 -0
  39. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  40. data/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  41. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  42. data/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  43. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  44. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  48. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  49. data/lib/rdoc/generator/template/darkfish/index.rhtml +11 -7
  50. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -15
  51. data/lib/rdoc/generator/template/darkfish/js/search.js +12 -4
  52. data/lib/rdoc/generator/template/darkfish/page.rhtml +9 -9
  53. data/lib/rdoc/generator/template/darkfish/rdoc.css +226 -241
  54. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +5 -5
  55. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +13 -6
  56. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +17 -14
  57. data/lib/rdoc/include.rb +4 -114
  58. data/lib/rdoc/known_classes.rb +1 -0
  59. data/lib/rdoc/markdown.kpeg +126 -117
  60. data/lib/rdoc/markdown.rb +404 -389
  61. data/lib/rdoc/markdown/literals_1_8.kpeg +1 -1
  62. data/lib/rdoc/markdown/literals_1_8.rb +15 -12
  63. data/lib/rdoc/markdown/literals_1_9.kpeg +1 -1
  64. data/lib/rdoc/markdown/literals_1_9.rb +15 -12
  65. data/lib/rdoc/markup.rb +10 -13
  66. data/lib/rdoc/markup/attribute_manager.rb +3 -2
  67. data/lib/rdoc/markup/formatter.rb +3 -3
  68. data/lib/rdoc/markup/heading.rb +13 -0
  69. data/lib/rdoc/markup/parser.rb +10 -3
  70. data/lib/rdoc/markup/pre_process.rb +1 -1
  71. data/lib/rdoc/markup/to_html.rb +46 -31
  72. data/lib/rdoc/markup/to_html_crossref.rb +3 -0
  73. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  74. data/lib/rdoc/markup/to_markdown.rb +7 -5
  75. data/lib/rdoc/markup/verbatim.rb +1 -1
  76. data/lib/rdoc/method_attr.rb +13 -1
  77. data/lib/rdoc/mixin.rb +120 -0
  78. data/lib/rdoc/normal_class.rb +4 -0
  79. data/lib/rdoc/normal_module.rb +4 -0
  80. data/lib/rdoc/options.rb +42 -8
  81. data/lib/rdoc/parser.rb +4 -2
  82. data/lib/rdoc/parser/c.rb +13 -7
  83. data/lib/rdoc/parser/ruby.rb +683 -480
  84. data/lib/rdoc/rdoc.rb +4 -3
  85. data/lib/rdoc/ri/driver.rb +174 -103
  86. data/lib/rdoc/ri/paths.rb +6 -6
  87. data/lib/rdoc/ruby_lex.rb +125 -102
  88. data/lib/rdoc/ruby_token.rb +41 -40
  89. data/lib/rdoc/servlet.rb +16 -6
  90. data/lib/rdoc/stats.rb +61 -48
  91. data/lib/rdoc/store.rb +5 -3
  92. data/lib/rdoc/test_case.rb +39 -0
  93. data/lib/rdoc/tom_doc.rb +28 -4
  94. data/lib/rdoc/top_level.rb +2 -2
  95. data/test/test_rdoc_any_method.rb +104 -1
  96. data/test/test_rdoc_class_module.rb +9 -15
  97. data/test/test_rdoc_code_object.rb +133 -8
  98. data/test/test_rdoc_context.rb +17 -0
  99. data/test/test_rdoc_context_section.rb +0 -7
  100. data/test/test_rdoc_cross_reference.rb +4 -3
  101. data/test/test_rdoc_generator_darkfish.rb +61 -19
  102. data/test/test_rdoc_generator_json_index.rb +0 -11
  103. data/test/test_rdoc_generator_ri.rb +0 -8
  104. data/test/test_rdoc_markdown.rb +15 -12
  105. data/test/test_rdoc_markdown_test.rb +0 -7
  106. data/test/test_rdoc_markup_attribute_manager.rb +121 -0
  107. data/test/test_rdoc_markup_document.rb +0 -7
  108. data/test/test_rdoc_markup_formatter.rb +29 -3
  109. data/test/test_rdoc_markup_heading.rb +9 -0
  110. data/test/test_rdoc_markup_parser.rb +0 -7
  111. data/test/test_rdoc_markup_pre_process.rb +15 -3
  112. data/test/test_rdoc_markup_raw.rb +0 -7
  113. data/test/test_rdoc_markup_to_html.rb +50 -8
  114. data/test/test_rdoc_markup_to_html_crossref.rb +7 -0
  115. data/test/test_rdoc_markup_to_html_snippet.rb +4 -4
  116. data/test/test_rdoc_markup_to_markdown.rb +6 -0
  117. data/test/test_rdoc_method_attr.rb +8 -0
  118. data/test/test_rdoc_normal_class.rb +5 -0
  119. data/test/test_rdoc_normal_module.rb +5 -0
  120. data/test/test_rdoc_options.rb +61 -22
  121. data/test/test_rdoc_parser.rb +10 -0
  122. data/test/test_rdoc_parser_c.rb +17 -5
  123. data/test/test_rdoc_parser_changelog.rb +0 -7
  124. data/test/test_rdoc_parser_rd.rb +0 -7
  125. data/test/test_rdoc_parser_ruby.rb +305 -28
  126. data/test/test_rdoc_rd_block_parser.rb +0 -8
  127. data/test/test_rdoc_rd_inline_parser.rb +0 -1
  128. data/test/test_rdoc_rdoc.rb +27 -1
  129. data/test/test_rdoc_ri_driver.rb +19 -7
  130. data/test/test_rdoc_ruby_lex.rb +116 -9
  131. data/test/test_rdoc_rubygems_hook.rb +1 -1
  132. data/test/test_rdoc_servlet.rb +44 -6
  133. data/test/test_rdoc_stats.rb +161 -141
  134. data/test/test_rdoc_store.rb +11 -19
  135. data/test/test_rdoc_text.rb +0 -7
  136. data/test/test_rdoc_tom_doc.rb +44 -16
  137. data/test/xref_test_case.rb +2 -0
  138. metadata +28 -27
  139. metadata.gz.sig +0 -0
  140. data/test/test_attribute_manager.rb +0 -120
@@ -9,6 +9,7 @@ class TestRDocStore < XrefTestCase
9
9
 
10
10
  @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_store_#{$$}"
11
11
  @s = RDoc::RI::Store.new @tmpdir
12
+ @s.rdoc = @rdoc
12
13
 
13
14
  @top_level = @s.add_file 'file.rb'
14
15
 
@@ -71,13 +72,6 @@ class TestRDocStore < XrefTestCase
71
72
  FileUtils.rm_rf @tmpdir
72
73
  end
73
74
 
74
- def mu_pp obj
75
- s = ''
76
- s = PP.pp obj, s
77
- s.force_encoding Encoding.default_external if defined? Encoding
78
- s.chomp
79
- end
80
-
81
75
  def assert_cache imethods, cmethods, attrs, modules,
82
76
  ancestors = {}, pages = [], main = nil, title = nil
83
77
  imethods ||= { 'Object' => %w[method method! method_bang] }
@@ -106,18 +100,6 @@ class TestRDocStore < XrefTestCase
106
100
  assert_equal expected, @s.cache
107
101
  end
108
102
 
109
- def assert_directory path
110
- assert File.directory?(path), "#{path} is not a directory"
111
- end
112
-
113
- def assert_file path
114
- assert File.file?(path), "#{path} is not a file"
115
- end
116
-
117
- def refute_file path
118
- refute File.exist?(path), "#{path} exists"
119
- end
120
-
121
103
  def test_add_c_enclosure
122
104
  @s.add_c_enclosure 'cC1', @c1
123
105
 
@@ -249,6 +231,16 @@ class TestRDocStore < XrefTestCase
249
231
  refute_empty a1.aliases
250
232
  end
251
233
 
234
+ def test_complete_nodoc
235
+ c_nodoc = @top_level.add_class RDoc::NormalClass, 'Nodoc'
236
+ c_nodoc.record_location @top_level
237
+ c_nodoc.document_self = nil
238
+
239
+ @s.complete :nodoc
240
+
241
+ assert_includes @s.classes_hash.keys, 'Nodoc'
242
+ end
243
+
252
244
  def test_find_c_enclosure
253
245
  assert_nil @s.find_c_enclosure 'cC1'
254
246
 
@@ -14,13 +14,6 @@ class TestRDocText < RDoc::TestCase
14
14
  @top_level = @store.add_file 'file.rb'
15
15
  end
16
16
 
17
- def mu_pp obj
18
- s = ''
19
- s = PP.pp obj, s
20
- s = s.force_encoding Encoding.default_external if defined? Encoding
21
- s.chomp
22
- end
23
-
24
17
  def test_self_encode_fallback
25
18
  skip "Encoding not implemented" unless Object.const_defined? :Encoding
26
19
 
@@ -11,13 +11,6 @@ class TestRDocTomDoc < RDoc::TestCase
11
11
  @td = @TD.new
12
12
  end
13
13
 
14
- def mu_pp obj
15
- s = ''
16
- s = PP.pp obj, s
17
- s = s.force_encoding Encoding.default_external if defined? Encoding
18
- s.chomp
19
- end
20
-
21
14
  def test_class_add_post_processor
22
15
  RDoc::TomDoc.add_post_processor
23
16
 
@@ -135,6 +128,17 @@ here - something
135
128
  assert_equal expected, @TD.parse(text)
136
129
  end
137
130
 
131
+ def test_parse_multiline_paragraph
132
+ text = "Public: Do some stuff\n"
133
+ text << "On a new line\n"
134
+
135
+ expected =
136
+ doc(
137
+ para('Do some stuff', ' ', 'On a new line'))
138
+
139
+ assert_equal expected, @TD.parse(text)
140
+ end
141
+
138
142
  def test_parse_arguments
139
143
  text = <<-TEXT
140
144
  Create new Arg object.
@@ -188,7 +192,7 @@ foo - A comment goes here
188
192
  blank_line,
189
193
  list(:NOTE,
190
194
  item(%w[foo],
191
- para('A comment goes here', 'and is more than one line'))))
195
+ para('A comment goes here', ' ', 'and is more than one line'))))
192
196
 
193
197
  assert_equal expected, @TD.parse(text)
194
198
  end
@@ -279,13 +283,19 @@ Signature
279
283
  Do some stuff
280
284
 
281
285
  Returns a thing
286
+
287
+ Returns another thing
282
288
  TEXT
283
289
 
284
290
  expected =
285
- @RM::Document.new(
286
- @RM::Paragraph.new('Do some stuff'),
287
- @RM::BlankLine.new,
288
- @RM::Paragraph.new('Returns a thing'))
291
+ doc(
292
+ para('Do some stuff'),
293
+ blank_line,
294
+ head(3, 'Returns'),
295
+ blank_line,
296
+ para('Returns a thing'),
297
+ blank_line,
298
+ para('Returns another thing'))
289
299
 
290
300
  assert_equal expected, @TD.parse(text)
291
301
  end
@@ -299,10 +309,12 @@ Returns a thing
299
309
  TEXT
300
310
 
301
311
  expected =
302
- @RM::Document.new(
303
- @RM::Paragraph.new('Do some stuff'),
304
- @RM::BlankLine.new,
305
- @RM::Paragraph.new('Returns a thing', 'that is multiline'))
312
+ doc(
313
+ para('Do some stuff'),
314
+ blank_line,
315
+ head(3, 'Returns'),
316
+ blank_line,
317
+ para('Returns a thing', ' ', 'that is multiline'))
306
318
 
307
319
  assert_equal expected, @TD.parse(text)
308
320
  end
@@ -338,6 +350,22 @@ Signature
338
350
  assert_equal expected, @td.tokens
339
351
  end
340
352
 
353
+ def test_tokenize_multiline_paragraph
354
+ text = "Public: Do some stuff\n"
355
+ text << "On a new line\n"
356
+
357
+ @td.tokenize text
358
+
359
+ expected = [
360
+ [:TEXT, "Do some stuff", 0, 0],
361
+ [:NEWLINE, "\n", 13, 0],
362
+ [:TEXT, "On a new line", 0, 1],
363
+ [:NEWLINE, "\n", 13, 1]
364
+ ]
365
+
366
+ assert_equal expected, @td.tokens
367
+ end
368
+
341
369
  def test_tokenize_arguments
342
370
  @td.tokenize <<-TEXT
343
371
  Create new Arg object.
@@ -11,6 +11,8 @@ class XrefTestCase < RDoc::TestCase
11
11
  @options = RDoc::Options.new
12
12
  @options.quiet = true
13
13
 
14
+ @rdoc.options = @options
15
+
14
16
  @file_name = 'xref_data.rb'
15
17
  @xref_data = @store.add_file @file_name
16
18
  @top_level = @xref_data
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.1.0.preview.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -33,7 +33,7 @@ cert_chain:
33
33
  KDyY1VIazVgoC8XvR4h/95/iScPiuglzA+DBG1hip1xScAtw05BrXyUNrc9CEMYU
34
34
  wgF94UVoHRp6ywo8I7NP3HcwFQDFNEZPNGXsng==
35
35
  -----END CERTIFICATE-----
36
- date: 2013-03-27 00:00:00.000000000 Z
36
+ date: 2013-12-03 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: json
@@ -69,28 +69,28 @@ dependencies:
69
69
  requirements:
70
70
  - - ~>
71
71
  - !ruby/object:Gem::Version
72
- version: '4.6'
72
+ version: '5.0'
73
73
  type: :development
74
74
  prerelease: false
75
75
  version_requirements: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
- version: '4.6'
79
+ version: '5.0'
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rdoc
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - ~>
85
85
  - !ruby/object:Gem::Version
86
- version: '3.10'
86
+ version: '4.0'
87
87
  type: :development
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '3.10'
93
+ version: '4.0'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: racc
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +98,9 @@ dependencies:
98
98
  - - ~>
99
99
  - !ruby/object:Gem::Version
100
100
  version: '1.4'
101
+ - - '!='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.4.10
101
104
  type: :development
102
105
  prerelease: false
103
106
  version_requirements: !ruby/object:Gem::Requirement
@@ -105,34 +108,23 @@ dependencies:
105
108
  - - ~>
106
109
  - !ruby/object:Gem::Version
107
110
  version: '1.4'
108
- - !ruby/object:Gem::Dependency
109
- name: ZenTest
110
- requirement: !ruby/object:Gem::Requirement
111
- requirements:
112
- - - ~>
113
- - !ruby/object:Gem::Version
114
- version: '4'
115
- type: :development
116
- prerelease: false
117
- version_requirements: !ruby/object:Gem::Requirement
118
- requirements:
119
- - - ~>
111
+ - - '!='
120
112
  - !ruby/object:Gem::Version
121
- version: '4'
113
+ version: 1.4.10
122
114
  - !ruby/object:Gem::Dependency
123
115
  name: hoe
124
116
  requirement: !ruby/object:Gem::Requirement
125
117
  requirements:
126
118
  - - ~>
127
119
  - !ruby/object:Gem::Version
128
- version: '3.5'
120
+ version: '3.7'
129
121
  type: :development
130
122
  prerelease: false
131
123
  version_requirements: !ruby/object:Gem::Requirement
132
124
  requirements:
133
125
  - - ~>
134
126
  - !ruby/object:Gem::Version
135
- version: '3.5'
127
+ version: '3.7'
136
128
  description: |-
137
129
  RDoc produces HTML and command-line documentation for Ruby projects. RDoc
138
130
  includes the +rdoc+ and +ri+ tools for generating and displaying documentation
@@ -147,8 +139,10 @@ executables:
147
139
  - ri
148
140
  extensions: []
149
141
  extra_rdoc_files:
142
+ - CONTRIBUTING.rdoc
150
143
  - CVE-2013-0256.rdoc
151
- - DEVELOPERS.rdoc
144
+ - ExampleMarkdown.md
145
+ - ExampleRDoc.rdoc
152
146
  - History.rdoc
153
147
  - LEGAL.rdoc
154
148
  - LICENSE.rdoc
@@ -156,13 +150,14 @@ extra_rdoc_files:
156
150
  - README.rdoc
157
151
  - RI.rdoc
158
152
  - TODO.rdoc
159
- - bin/rdoc
160
153
  - Rakefile
161
154
  files:
162
155
  - .autotest
163
156
  - .document
157
+ - CONTRIBUTING.rdoc
164
158
  - CVE-2013-0256.rdoc
165
- - DEVELOPERS.rdoc
159
+ - ExampleMarkdown.md
160
+ - ExampleRDoc.rdoc
166
161
  - History.rdoc
167
162
  - LEGAL.rdoc
168
163
  - LICENSE.rdoc
@@ -213,6 +208,13 @@ files:
213
208
  - lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
214
209
  - lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
215
210
  - lib/rdoc/generator/template/darkfish/class.rhtml
211
+ - lib/rdoc/generator/template/darkfish/fonts.css
212
+ - lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
213
+ - lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
214
+ - lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
215
+ - lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf
216
+ - lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf
217
+ - lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf
216
218
  - lib/rdoc/generator/template/darkfish/images/add.png
217
219
  - lib/rdoc/generator/template/darkfish/images/arrow_up.png
218
220
  - lib/rdoc/generator/template/darkfish/images/brick.png
@@ -299,6 +301,7 @@ files:
299
301
  - lib/rdoc/markup/verbatim.rb
300
302
  - lib/rdoc/meta_method.rb
301
303
  - lib/rdoc/method_attr.rb
304
+ - lib/rdoc/mixin.rb
302
305
  - lib/rdoc/normal_class.rb
303
306
  - lib/rdoc/normal_module.rb
304
307
  - lib/rdoc/options.rb
@@ -369,7 +372,6 @@ files:
369
372
  - test/test.ja.rdoc
370
373
  - test/test.ja.txt
371
374
  - test/test.txt
372
- - test/test_attribute_manager.rb
373
375
  - test/test_rdoc_alias.rb
374
376
  - test/test_rdoc_any_method.rb
375
377
  - test/test_rdoc_attr.rb
@@ -476,12 +478,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
476
478
  version: '1.3'
477
479
  requirements: []
478
480
  rubyforge_project: rdoc
479
- rubygems_version: 2.0.3
481
+ rubygems_version: 2.1.11
480
482
  signing_key:
481
483
  specification_version: 4
482
484
  summary: RDoc produces HTML and command-line documentation for Ruby projects
483
485
  test_files:
484
- - test/test_attribute_manager.rb
485
486
  - test/test_rdoc_alias.rb
486
487
  - test/test_rdoc_any_method.rb
487
488
  - test/test_rdoc_attr.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,120 +0,0 @@
1
- require 'rdoc/test_case'
2
-
3
- class TestAttributeManager < RDoc::TestCase # HACK fix test name
4
-
5
- def setup
6
- super
7
-
8
- @options = RDoc::Options.new
9
-
10
- @am = RDoc::Markup::AttributeManager.new
11
- @klass = RDoc::Markup::AttributeManager
12
- @formatter = RDoc::Markup::Formatter.new @options
13
- @formatter.add_tag :BOLD, '<B>', '</B>'
14
- @formatter.add_tag :EM, '<EM>', '</EM>'
15
- @formatter.add_tag :TT, '<CODE>', '</CODE>'
16
- end
17
-
18
- def test_convert_attrs_ignores_code
19
- assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <code>__send__</code> bar')
20
- end
21
-
22
- def test_convert_attrs_ignores_tt
23
- assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <tt>__send__</tt> bar')
24
- end
25
-
26
- def test_convert_attrs_preserves_double
27
- assert_equal 'foo.__send__ :bar', output('foo.__send__ :bar')
28
- assert_equal 'use __FILE__ to', output('use __FILE__ to')
29
- end
30
-
31
- def test_convert_attrs_does_not_ignore_after_tt
32
- assert_equal 'the <CODE>IF:</CODE><EM>key</EM> directive', output('the <tt>IF:</tt>_key_ directive')
33
- end
34
-
35
- def test_initial_word_pairs
36
- word_pairs = @am.matching_word_pairs
37
- assert word_pairs.is_a?(Hash)
38
- assert_equal(3, word_pairs.size)
39
- end
40
-
41
- def test_initial_html
42
- html_tags = @am.html_tags
43
- assert html_tags.is_a?(Hash)
44
- assert_equal(5, html_tags.size)
45
- end
46
-
47
- def test_add_matching_word_pair
48
- @am.add_word_pair("x","x", :TEST)
49
- word_pairs = @am.matching_word_pairs
50
- assert_equal(4,word_pairs.size)
51
- assert(word_pairs.has_key?("x"))
52
- end
53
-
54
- def test_add_invalid_word_pair
55
- assert_raises ArgumentError do
56
- @am.add_word_pair("<", "<", :TEST)
57
- end
58
- end
59
-
60
- def test_add_word_pair_map
61
- @am.add_word_pair("x", "y", :TEST)
62
- word_pair_map = @am.word_pair_map
63
- assert_equal(1,word_pair_map.size)
64
- assert_equal(word_pair_map. keys.first.source, "(x)(\\S+)(y)")
65
- end
66
-
67
- def test_add_html_tag
68
- @am.add_html("Test", :TEST)
69
- tags = @am.html_tags
70
- assert_equal(6, tags.size)
71
- assert(tags.has_key?("test"))
72
- end
73
-
74
- def test_add_special
75
- @am.add_special "WikiWord", :WIKIWORD
76
- specials = @am.special
77
-
78
- assert_equal 1, specials.size
79
- assert specials.assoc "WikiWord"
80
- end
81
-
82
- def test_escapes
83
- assert_equal '<CODE>text</CODE>', output('<tt>text</tt>')
84
- assert_equal '<tt>text</tt>', output('\\<tt>text</tt>')
85
- assert_equal '<tt>', output('\\<tt>')
86
- assert_equal '<CODE><tt></CODE>', output('<tt>\\<tt></tt>')
87
- assert_equal '<CODE>\\<tt></CODE>', output('<tt>\\\\<tt></tt>')
88
- assert_equal '<B>text</B>', output('*text*')
89
- assert_equal '*text*', output('\\*text*')
90
- assert_equal '\\', output('\\')
91
- assert_equal '\\text', output('\\text')
92
- assert_equal '\\\\text', output('\\\\text')
93
- assert_equal 'text \\ text', output('text \\ text')
94
-
95
- assert_equal 'and <CODE>\\s</CODE> matches space',
96
- output('and <tt>\\s</tt> matches space')
97
- assert_equal 'use <CODE><tt>text</CODE></tt> for code',
98
- output('use <tt>\\<tt>text</tt></tt> for code')
99
- assert_equal 'use <CODE><tt>text</tt></CODE> for code',
100
- output('use <tt>\\<tt>text\\</tt></tt> for code')
101
- assert_equal 'use <tt><tt>text</tt></tt> for code',
102
- output('use \\<tt>\\<tt>text</tt></tt> for code')
103
- assert_equal 'use <tt><CODE>text</CODE></tt> for code',
104
- output('use \\<tt><tt>text</tt></tt> for code')
105
- assert_equal 'use <CODE>+text+</CODE> for code',
106
- output('use <tt>\\+text+</tt> for code')
107
- assert_equal 'use <tt><CODE>text</CODE></tt> for code',
108
- output('use \\<tt>+text+</tt> for code')
109
- assert_equal 'illegal <tag>not</tag> changed',
110
- output('illegal <tag>not</tag> changed')
111
- assert_equal 'unhandled <p>tag</p> unchanged',
112
- output('unhandled <p>tag</p> unchanged')
113
- end
114
-
115
- def output str
116
- @formatter.convert_flow @am.flow str
117
- end
118
-
119
- end
120
-