rdoc 2.5.11 → 3.0

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 (113) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.document +1 -0
  3. data/History.txt +95 -0
  4. data/Manifest.txt +13 -4
  5. data/README.txt +9 -3
  6. data/Rakefile +1 -1
  7. data/lib/rdoc.rb +15 -298
  8. data/lib/rdoc/alias.rb +65 -16
  9. data/lib/rdoc/any_method.rb +27 -150
  10. data/lib/rdoc/attr.rb +36 -115
  11. data/lib/rdoc/class_module.rb +236 -22
  12. data/lib/rdoc/code_object.rb +76 -31
  13. data/lib/rdoc/constant.rb +32 -4
  14. data/lib/rdoc/context.rb +494 -222
  15. data/lib/rdoc/encoding.rb +79 -0
  16. data/lib/rdoc/erbio.rb +37 -0
  17. data/lib/rdoc/gauntlet.rb +9 -5
  18. data/lib/rdoc/generator.rb +33 -1
  19. data/lib/rdoc/generator/darkfish.rb +284 -375
  20. data/lib/rdoc/generator/markup.rb +72 -36
  21. data/lib/rdoc/generator/ri.rb +4 -4
  22. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +267 -274
  23. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +91 -91
  24. data/lib/rdoc/generator/template/darkfish/index.rhtml +45 -45
  25. data/lib/rdoc/generator/template/darkfish/rdoc.css +298 -298
  26. data/lib/rdoc/include.rb +40 -1
  27. data/lib/rdoc/known_classes.rb +1 -0
  28. data/lib/rdoc/markup.rb +467 -2
  29. data/lib/rdoc/markup/attribute_manager.rb +24 -6
  30. data/lib/rdoc/markup/blank_line.rb +11 -3
  31. data/lib/rdoc/markup/document.rb +6 -0
  32. data/lib/rdoc/markup/formatter.rb +10 -0
  33. data/lib/rdoc/markup/formatter_test_case.rb +339 -3
  34. data/lib/rdoc/markup/heading.rb +3 -0
  35. data/lib/rdoc/markup/inline.rb +11 -1
  36. data/lib/rdoc/markup/list.rb +3 -0
  37. data/lib/rdoc/markup/list_item.rb +3 -0
  38. data/lib/rdoc/markup/paragraph.rb +3 -0
  39. data/lib/rdoc/markup/parser.rb +191 -237
  40. data/lib/rdoc/markup/{preprocess.rb → pre_process.rb} +50 -29
  41. data/lib/rdoc/markup/raw.rb +4 -0
  42. data/lib/rdoc/markup/rule.rb +3 -0
  43. data/lib/rdoc/markup/text_formatter_test_case.rb +116 -0
  44. data/lib/rdoc/markup/to_ansi.rb +14 -2
  45. data/lib/rdoc/markup/to_bs.rb +8 -2
  46. data/lib/rdoc/markup/to_html.rb +84 -91
  47. data/lib/rdoc/markup/to_html_crossref.rb +77 -26
  48. data/lib/rdoc/markup/to_rdoc.rb +94 -49
  49. data/lib/rdoc/markup/to_test.rb +9 -1
  50. data/lib/rdoc/markup/verbatim.rb +6 -3
  51. data/lib/rdoc/method_attr.rb +353 -0
  52. data/lib/rdoc/normal_class.rb +11 -2
  53. data/lib/rdoc/normal_module.rb +0 -5
  54. data/lib/rdoc/options.rb +373 -82
  55. data/lib/rdoc/parser.rb +59 -23
  56. data/lib/rdoc/parser/c.rb +224 -86
  57. data/lib/rdoc/parser/ruby.rb +219 -111
  58. data/lib/rdoc/parser/ruby_tools.rb +4 -1
  59. data/lib/rdoc/parser/simple.rb +9 -4
  60. data/lib/rdoc/rdoc.rb +68 -28
  61. data/lib/rdoc/require.rb +21 -0
  62. data/lib/rdoc/ri/driver.rb +20 -10
  63. data/lib/rdoc/ri/paths.rb +2 -2
  64. data/lib/rdoc/ri/store.rb +22 -5
  65. data/lib/rdoc/ruby_lex.rb +11 -12
  66. data/lib/rdoc/ruby_token.rb +2 -2
  67. data/lib/rdoc/single_class.rb +2 -1
  68. data/lib/rdoc/stats.rb +202 -162
  69. data/lib/rdoc/stats/normal.rb +51 -0
  70. data/lib/rdoc/stats/quiet.rb +59 -0
  71. data/lib/rdoc/stats/verbose.rb +45 -0
  72. data/lib/rdoc/text.rb +133 -4
  73. data/lib/rdoc/{tokenstream.rb → token_stream.rb} +0 -2
  74. data/lib/rdoc/top_level.rb +230 -39
  75. data/test/test_attribute_manager.rb +58 -7
  76. data/test/test_rdoc_alias.rb +13 -0
  77. data/test/test_rdoc_any_method.rb +43 -2
  78. data/test/test_rdoc_attr.rb +15 -8
  79. data/test/test_rdoc_class_module.rb +133 -0
  80. data/test/test_rdoc_code_object.rb +62 -5
  81. data/test/test_rdoc_context.rb +72 -26
  82. data/test/test_rdoc_encoding.rb +145 -0
  83. data/test/test_rdoc_generator_darkfish.rb +119 -0
  84. data/test/test_rdoc_generator_ri.rb +22 -2
  85. data/test/test_rdoc_include.rb +79 -0
  86. data/test/test_rdoc_markup_attribute_manager.rb +4 -4
  87. data/test/test_rdoc_markup_parser.rb +134 -95
  88. data/test/test_rdoc_markup_pre_process.rb +7 -2
  89. data/test/test_rdoc_markup_to_ansi.rb +43 -153
  90. data/test/test_rdoc_markup_to_bs.rb +42 -156
  91. data/test/test_rdoc_markup_to_html.rb +130 -58
  92. data/test/test_rdoc_markup_to_html_crossref.rb +10 -10
  93. data/test/test_rdoc_markup_to_rdoc.rb +40 -151
  94. data/test/test_rdoc_method_attr.rb +122 -0
  95. data/test/test_rdoc_normal_class.rb +1 -1
  96. data/test/test_rdoc_normal_module.rb +6 -1
  97. data/test/test_rdoc_options.rb +237 -12
  98. data/test/test_rdoc_parser.rb +3 -22
  99. data/test/test_rdoc_parser_c.rb +203 -2
  100. data/test/test_rdoc_parser_ruby.rb +403 -89
  101. data/test/test_rdoc_parser_simple.rb +25 -1
  102. data/test/test_rdoc_rdoc.rb +44 -32
  103. data/test/test_rdoc_ri_driver.rb +29 -24
  104. data/test/test_rdoc_ri_store.rb +46 -3
  105. data/test/test_rdoc_task.rb +1 -1
  106. data/test/test_rdoc_text.rb +102 -8
  107. data/test/test_rdoc_top_level.rb +13 -4
  108. data/test/xref_data.rb +8 -0
  109. data/test/xref_test_case.rb +6 -0
  110. metadata +29 -19
  111. metadata.gz.sig +0 -0
  112. data/lib/rdoc/parser/perl.rb +0 -165
  113. data/test/test_rdoc_parser_perl.rb +0 -73
@@ -1,7 +1,7 @@
1
1
  require 'tempfile'
2
2
  require 'rubygems'
3
3
  require 'minitest/autorun'
4
- require 'rdoc/markup/preprocess'
4
+ require 'rdoc/markup/pre_process'
5
5
  require 'rdoc/code_objects'
6
6
 
7
7
  class TestRDocMarkupPreProcess < MiniTest::Unit::TestCase
@@ -31,13 +31,18 @@ contents of a string.
31
31
  @tempfile.flush
32
32
  @tempfile.rewind
33
33
 
34
- content = @pp.include_file @file_name, ''
34
+ content = @pp.include_file @file_name, '', nil
35
35
 
36
36
  expected = <<-EXPECTED
37
37
  Regular expressions (<i>regexp</i>s) are patterns which describe the
38
38
  contents of a string.
39
39
  EXPECTED
40
40
 
41
+ # FIXME 1.9 fix on windoze
42
+ # preprocessor uses binread, so line endings are \r\n
43
+ expected.gsub!("\n", "\r\n") if
44
+ RUBY_VERSION =~ /^1.9/ && RUBY_PLATFORM =~ /mswin|mingw/
45
+
41
46
  assert_equal expected, content
42
47
  end
43
48
 
@@ -1,11 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rdoc/markup/formatter_test_case'
2
+ require 'rdoc/markup/text_formatter_test_case'
3
3
  require 'rdoc/markup/to_ansi'
4
4
  require 'minitest/autorun'
5
5
 
6
- class TestRDocMarkupToAnsi < RDoc::Markup::FormatterTestCase
6
+ class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
7
7
 
8
8
  add_visitor_tests
9
+ add_text_tests
9
10
 
10
11
  def setup
11
12
  super
@@ -62,7 +63,7 @@ class TestRDocMarkupToAnsi < RDoc::Markup::FormatterTestCase
62
63
  end
63
64
 
64
65
  def accept_list_item_end_label
65
- assert_equal "\e[0m\n", @to.res.join
66
+ assert_equal "\e[0m", @to.res.join
66
67
  assert_equal 0, @to.indent, 'indent'
67
68
  end
68
69
 
@@ -72,7 +73,7 @@ class TestRDocMarkupToAnsi < RDoc::Markup::FormatterTestCase
72
73
  end
73
74
 
74
75
  def accept_list_item_end_note
75
- assert_equal "\e[0m\n", @to.res.join
76
+ assert_equal "\e[0m", @to.res.join
76
77
  assert_equal 0, @to.indent, 'indent'
77
78
  end
78
79
 
@@ -191,8 +192,8 @@ class TestRDocMarkupToAnsi < RDoc::Markup::FormatterTestCase
191
192
  assert_equal "\e[0m#{'-' * 78}\n", @to.res.join
192
193
  end
193
194
 
194
- def accept_verbatim # FormatterTestCase doesn't set indent for ToAnsi
195
- assert_equal "\e[0m hi\n world\n\n", @to.res.join
195
+ def accept_verbatim
196
+ assert_equal "\e[0m hi\n world\n\n", @to.res.join
196
197
  end
197
198
 
198
199
  def end_accepting
@@ -207,214 +208,103 @@ class TestRDocMarkupToAnsi < RDoc::Markup::FormatterTestCase
207
208
  assert_empty @to.list_width
208
209
  end
209
210
 
210
- def test_accept_heading_1
211
- @to.start_accepting
212
- @to.accept_heading @RM::Heading.new(1, 'Hello')
213
-
211
+ def accept_heading_1
214
212
  assert_equal "\e[0m\e[1;32mHello\e[m\n", @to.end_accepting
215
213
  end
216
214
 
217
- def test_accept_heading_2
218
- @to.start_accepting
219
- @to.accept_heading @RM::Heading.new(2, 'Hello')
220
-
215
+ def accept_heading_2
221
216
  assert_equal "\e[0m\e[4;32mHello\e[m\n", @to.end_accepting
222
217
  end
223
218
 
224
- def test_accept_heading_3
225
- @to.start_accepting
226
- @to.accept_heading @RM::Heading.new(3, 'Hello')
227
-
219
+ def accept_heading_3
228
220
  assert_equal "\e[0m\e[32mHello\e[m\n", @to.end_accepting
229
221
  end
230
222
 
231
- def test_accept_heading_4
232
- @to.start_accepting
233
- @to.accept_heading @RM::Heading.new(4, 'Hello')
234
-
223
+ def accept_heading_4
235
224
  assert_equal "\e[0mHello\n", @to.end_accepting
236
225
  end
237
226
 
238
- def test_accept_heading_indent
239
- @to.start_accepting
240
- @to.indent = 3
241
- @to.accept_heading @RM::Heading.new(1, 'Hello')
242
-
227
+ def accept_heading_indent
243
228
  assert_equal "\e[0m \e[1;32mHello\e[m\n", @to.end_accepting
244
229
  end
245
230
 
246
- def test_accept_heading_b
247
- @to.start_accepting
248
- @to.indent = 3
249
- @to.accept_heading @RM::Heading.new(1, '*Hello*')
250
-
251
- assert_equal "\e[0m \e[1;32m\e[1mHello\e[m\e[m\n", @to.end_accepting
231
+ def accept_heading_b
232
+ assert_equal "\e[0m\e[1;32m\e[1mHello\e[m\e[m\n", @to.end_accepting
252
233
  end
253
234
 
254
- def test_accept_list_item_start_note_2
255
- list = @RM::List.new(:NOTE,
256
- @RM::ListItem.new('<tt>teletype</tt>',
257
- @RM::Paragraph.new('teletype description')))
258
-
259
- @to.start_accepting
260
-
261
- list.accept @to
262
-
263
- expected = "\e[0m\e[7mteletype\e[m:\n teletype description\n\n"
264
-
265
- assert_equal expected, @to.end_accepting
235
+ def accept_heading_suppressed_crossref
236
+ assert_equal "\e[0m\e[1;32mHello\e[m\n", @to.end_accepting
266
237
  end
267
238
 
268
- def test_accept_paragraph_b
269
- @to.start_accepting
270
- @to.accept_paragraph @RM::Paragraph.new('reg <b>bold words</b> reg')
271
-
272
- expected = "\e[0mreg \e[1mbold words\e[m reg\n"
273
-
274
- assert_equal expected, @to.end_accepting
239
+ def accept_list_item_start_note_2
240
+ assert_equal "\e[0m\e[7mteletype\e[m:\n teletype description\n\n",
241
+ @to.res.join
275
242
  end
276
243
 
277
- def test_accept_paragraph_i
278
- @to.start_accepting
279
- @to.accept_paragraph @RM::Paragraph.new('reg <em>italic words</em> reg')
280
-
281
- expected = "\e[0mreg \e[4mitalic words\e[m reg\n"
282
-
283
- assert_equal expected, @to.end_accepting
244
+ def accept_paragraph_b
245
+ assert_equal "\e[0mreg \e[1mbold words\e[m reg\n", @to.end_accepting
284
246
  end
285
247
 
286
- def test_accept_paragraph_indent
287
- @to.start_accepting
288
- @to.indent = 3
289
- @to.accept_paragraph @RM::Paragraph.new('words ' * 30)
248
+ def accept_paragraph_i
249
+ assert_equal "\e[0mreg \e[4mitalic words\e[m reg\n", @to.end_accepting
250
+ end
290
251
 
252
+ def accept_paragraph_indent
291
253
  expected = <<-EXPECTED
292
254
  \e[0m words words words words words words words words words words words words
293
255
  words words words words words words words words words words words words
294
- words words words words words words
256
+ words words words words words words
295
257
  EXPECTED
296
258
 
297
259
  assert_equal expected, @to.end_accepting
298
260
  end
299
261
 
300
- def test_accept_paragraph_plus
301
- @to.start_accepting
302
- @to.accept_paragraph @RM::Paragraph.new('regular +teletype+ regular')
303
-
304
- expected = "\e[0mregular \e[7mteletype\e[m regular\n"
305
-
306
- assert_equal expected, @to.end_accepting
262
+ def accept_paragraph_plus
263
+ assert_equal "\e[0mreg \e[7mteletype\e[m reg\n", @to.end_accepting
307
264
  end
308
265
 
309
- def test_accept_paragraph_star
310
- @to.start_accepting
311
- @to.accept_paragraph @RM::Paragraph.new('regular *bold* regular')
312
-
313
- expected = "\e[0mregular \e[1mbold\e[m regular\n"
314
-
315
- assert_equal expected, @to.end_accepting
266
+ def accept_paragraph_star
267
+ assert_equal "\e[0mreg \e[1mbold\e[m reg\n", @to.end_accepting
316
268
  end
317
269
 
318
- def test_accept_paragraph_underscore
319
- @to.start_accepting
320
- @to.accept_paragraph @RM::Paragraph.new('regular _italic_ regular')
321
-
322
- expected = "\e[0mregular \e[4mitalic\e[m regular\n"
323
-
324
- assert_equal expected, @to.end_accepting
270
+ def accept_paragraph_underscore
271
+ assert_equal "\e[0mreg \e[4mitalic\e[m reg\n", @to.end_accepting
325
272
  end
326
273
 
327
- def test_accept_paragraph_wrap
328
- @to.start_accepting
329
- @to.accept_paragraph @RM::Paragraph.new('words ' * 30)
330
-
274
+ def accept_paragraph_wrap
331
275
  expected = <<-EXPECTED
332
276
  \e[0mwords words words words words words words words words words words words words
333
277
  words words words words words words words words words words words words words
334
- words words words words
278
+ words words words words
335
279
  EXPECTED
336
280
 
337
281
  assert_equal expected, @to.end_accepting
338
282
  end
339
283
 
340
- def test_accept_rule_indent
341
- @to.start_accepting
342
- @to.indent = 3
343
-
344
- @to.accept_rule @RM::Rule.new(1)
345
-
284
+ def accept_rule_indent
346
285
  assert_equal "\e[0m #{'-' * 75}\n", @to.end_accepting
347
286
  end
348
287
 
349
- def test_accept_verbatim_indent
350
- @to.start_accepting
351
-
352
- @to.indent = 2
353
-
354
- @to.accept_verbatim @RM::Verbatim.new(' ', 'hi', "\n",
355
- ' ', 'world', "\n")
356
-
288
+ def accept_verbatim_indent
357
289
  assert_equal "\e[0m hi\n world\n\n", @to.end_accepting
358
290
  end
359
291
 
360
- def test_accept_verbatim_big_indent
361
- @to.start_accepting
362
-
363
- @to.indent = 2
364
-
365
- @to.accept_verbatim @RM::Verbatim.new(' ', 'hi', "\n",
366
- ' ', 'world', "\n")
367
-
292
+ def accept_verbatim_big_indent
368
293
  assert_equal "\e[0m hi\n world\n\n", @to.end_accepting
369
294
  end
370
295
 
371
- def test_attributes
372
- assert_equal 'Dog', @to.attributes("\\Dog")
373
- end
374
-
375
- def test_list_nested
376
- doc = @RM::Document.new(
377
- @RM::List.new(:BULLET,
378
- @RM::ListItem.new(nil,
379
- @RM::Paragraph.new('l1'),
380
- @RM::List.new(:BULLET,
381
- @RM::ListItem.new(nil,
382
- @RM::Paragraph.new('l1.1')))),
383
- @RM::ListItem.new(nil,
384
- @RM::Paragraph.new('l2'))))
385
-
386
- output = doc.accept @to
387
-
296
+ def list_nested
388
297
  expected = <<-EXPECTED
389
298
  \e[0m* l1
390
299
  * l1.1
391
300
  * l2
392
301
  EXPECTED
393
302
 
394
- assert_equal expected, output
395
- end
396
-
397
- def test_list_verbatim # HACK overblown
398
- doc = @RM::Document.new(
399
- @RM::List.new(:BULLET,
400
- @RM::ListItem.new(nil,
401
- @RM::Paragraph.new('list', 'stuff'),
402
- @RM::BlankLine.new(),
403
- @RM::Verbatim.new(' ', '*', ' ', 'list', "\n",
404
- ' ', 'with', "\n",
405
- "\n",
406
- ' ', 'second', "\n",
407
- "\n",
408
- ' ', '1.', ' ', 'indented', "\n",
409
- ' ', '2.', ' ', 'numbered', "\n",
410
- "\n",
411
- ' ', 'third', "\n",
412
- "\n",
413
- ' ', '*', ' ', 'second', "\n"))))
414
-
415
- output = doc.accept @to
303
+ assert_equal expected, @to.end_accepting
304
+ end
416
305
 
417
- expected = <<-EXPECTED
306
+ def list_verbatim
307
+ expected = <<-EXPECTED # HACK overblown
418
308
  \e[0m* list stuff
419
309
 
420
310
  * list
@@ -431,7 +321,7 @@ words words words words
431
321
 
432
322
  EXPECTED
433
323
 
434
- assert_equal expected, output
324
+ assert_equal expected, @to.end_accepting
435
325
  end
436
326
 
437
327
  end
@@ -1,11 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rdoc/markup/formatter_test_case'
2
+ require 'rdoc/markup/text_formatter_test_case'
3
3
  require 'rdoc/markup/to_bs'
4
4
  require 'minitest/autorun'
5
5
 
6
- class TestRDocMarkupToBs < RDoc::Markup::FormatterTestCase
6
+ class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
7
7
 
8
8
  add_visitor_tests
9
+ add_text_tests
9
10
 
10
11
  def setup
11
12
  super
@@ -63,6 +64,7 @@ class TestRDocMarkupToBs < RDoc::Markup::FormatterTestCase
63
64
  end
64
65
 
65
66
  def accept_list_item_end_label
67
+ assert_equal "\n", @to.res.join
66
68
  assert_equal 0, @to.indent, 'indent'
67
69
  end
68
70
 
@@ -72,6 +74,7 @@ class TestRDocMarkupToBs < RDoc::Markup::FormatterTestCase
72
74
  end
73
75
 
74
76
  def accept_list_item_end_note
77
+ assert_equal "\n", @to.res.join
75
78
  assert_equal 0, @to.indent, 'indent'
76
79
  end
77
80
 
@@ -190,8 +193,8 @@ class TestRDocMarkupToBs < RDoc::Markup::FormatterTestCase
190
193
  assert_equal "#{'-' * 78}\n", @to.res.join
191
194
  end
192
195
 
193
- def accept_verbatim # FormatterTestCase doesn't set indent for ToAnsi
194
- assert_equal " hi\n world\n\n", @to.res.join
196
+ def accept_verbatim
197
+ assert_equal " hi\n world\n\n", @to.res.join
195
198
  end
196
199
 
197
200
  def end_accepting
@@ -206,232 +209,115 @@ class TestRDocMarkupToBs < RDoc::Markup::FormatterTestCase
206
209
  assert_empty @to.list_width
207
210
  end
208
211
 
209
- def test_accept_heading_1
212
+ def accept_heading_1
210
213
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
211
- @to.start_accepting
212
- @to.accept_heading @RM::Heading.new(1, 'Hello')
213
-
214
214
  assert_equal "= H\bHe\bel\bll\blo\bo\n", @to.end_accepting
215
215
  end
216
216
 
217
- def test_accept_heading_2
217
+ def accept_heading_2
218
218
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
219
- @to.start_accepting
220
- @to.accept_heading @RM::Heading.new(2, 'Hello')
221
-
222
219
  assert_equal "== H\bHe\bel\bll\blo\bo\n", @to.end_accepting
223
220
  end
224
221
 
225
- def test_accept_heading_3
222
+ def accept_heading_3
226
223
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
227
- @to.start_accepting
228
- @to.accept_heading @RM::Heading.new(3, 'Hello')
229
-
230
224
  assert_equal "=== H\bHe\bel\bll\blo\bo\n", @to.end_accepting
231
225
  end
232
226
 
233
- def test_accept_heading_4
227
+ def accept_heading_4
234
228
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
235
- @to.start_accepting
236
- @to.accept_heading @RM::Heading.new(4, 'Hello')
237
-
238
229
  assert_equal "==== H\bHe\bel\bll\blo\bo\n", @to.end_accepting
239
230
  end
240
231
 
241
- def test_accept_heading_indent
232
+ def accept_heading_indent
242
233
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
243
- @to.start_accepting
244
- @to.indent = 3
245
- @to.accept_heading @RM::Heading.new(1, 'Hello')
246
-
247
234
  assert_equal " = H\bHe\bel\bll\blo\bo\n", @to.end_accepting
248
235
  end
249
236
 
250
- def test_accept_heading_b
237
+ def accept_heading_b
251
238
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
252
- @to.start_accepting
253
- @to.indent = 3
254
- @to.accept_heading @RM::Heading.new(1, '*Hello*')
255
-
256
- assert_equal " = H\bHe\bel\bll\blo\bo\n", @to.end_accepting
239
+ assert_equal "= H\bHe\bel\bll\blo\bo\n", @to.end_accepting
257
240
  end
258
241
 
259
- def test_accept_heading_suppressed_crossref
242
+ def accept_heading_suppressed_crossref
260
243
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
261
- @to.start_accepting
262
- @to.accept_heading @RM::Heading.new(1, '\\Hello')
263
-
264
244
  assert_equal "= H\bHe\bel\bll\blo\bo\n", @to.end_accepting
265
245
  end
266
246
 
267
- def test_accept_list_item_start_note_2
268
- list = @RM::List.new(:NOTE,
269
- @RM::ListItem.new('<tt>teletype</tt>',
270
- @RM::Paragraph.new('teletype description')))
271
-
272
- @to.start_accepting
273
-
274
- list.accept @to
275
-
276
- expected = "teletype:\n teletype description\n\n"
277
-
278
- assert_equal expected, @to.end_accepting
247
+ def accept_list_item_start_note_2
248
+ assert_equal "teletype:\n teletype description\n\n", @to.res.join
279
249
  end
280
250
 
281
- def test_accept_paragraph_b
251
+ def accept_paragraph_b
282
252
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
283
- @to.start_accepting
284
- @to.accept_paragraph @RM::Paragraph.new('reg <b>bold words</b> reg')
285
-
286
- expected = "reg b\bbo\bol\bld\bd \b w\bwo\bor\brd\bds\bs reg\n"
287
-
288
- assert_equal expected, @to.end_accepting
253
+ assert_equal "reg b\bbo\bol\bld\bd \b w\bwo\bor\brd\bds\bs reg\n",
254
+ @to.end_accepting
289
255
  end
290
256
 
291
- def test_accept_paragraph_i
257
+ def accept_paragraph_i
292
258
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
293
- @to.start_accepting
294
- @to.accept_paragraph @RM::Paragraph.new('reg <em>italic words</em> reg')
295
-
296
- expected = "reg _\bi_\bt_\ba_\bl_\bi_\bc_\b _\bw_\bo_\br_\bd_\bs reg\n"
297
-
298
- assert_equal expected, @to.end_accepting
259
+ assert_equal "reg _\bi_\bt_\ba_\bl_\bi_\bc_\b _\bw_\bo_\br_\bd_\bs reg\n",
260
+ @to.end_accepting
299
261
  end
300
262
 
301
- def test_accept_paragraph_indent
302
- @to.start_accepting
303
- @to.indent = 3
304
- @to.accept_paragraph @RM::Paragraph.new('words ' * 30)
305
-
263
+ def accept_paragraph_indent
306
264
  expected = <<-EXPECTED
307
265
  words words words words words words words words words words words words
308
266
  words words words words words words words words words words words words
309
- words words words words words words
267
+ words words words words words words
310
268
  EXPECTED
311
269
 
312
270
  assert_equal expected, @to.end_accepting
313
271
  end
314
272
 
315
- def test_accept_paragraph_plus
316
- @to.start_accepting
317
- @to.accept_paragraph @RM::Paragraph.new('regular +teletype+ regular')
318
-
319
- expected = "regular teletype regular\n"
320
-
321
- assert_equal expected, @to.end_accepting
273
+ def accept_paragraph_plus
274
+ assert_equal "reg teletype reg\n", @to.end_accepting
322
275
  end
323
276
 
324
- def test_accept_paragraph_star
277
+ def accept_paragraph_star
325
278
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
326
- @to.start_accepting
327
- @to.accept_paragraph @RM::Paragraph.new('regular *bold* regular')
328
-
329
- expected = "regular b\bbo\bol\bld\bd regular\n"
330
-
331
- assert_equal expected, @to.end_accepting
279
+ assert_equal "reg b\bbo\bol\bld\bd reg\n", @to.end_accepting
332
280
  end
333
281
 
334
- def test_accept_paragraph_underscore
282
+ def accept_paragraph_underscore
335
283
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
336
- @to.start_accepting
337
- @to.accept_paragraph @RM::Paragraph.new('regular _italic_ regular')
338
-
339
- expected = "regular _\bi_\bt_\ba_\bl_\bi_\bc regular\n"
340
-
341
- assert_equal expected, @to.end_accepting
284
+ assert_equal "reg _\bi_\bt_\ba_\bl_\bi_\bc reg\n", @to.end_accepting
342
285
  end
343
286
 
344
- def test_accept_paragraph_wrap
345
- @to.start_accepting
346
- @to.accept_paragraph @RM::Paragraph.new('words ' * 30)
347
-
287
+ def accept_paragraph_wrap
348
288
  expected = <<-EXPECTED
349
289
  words words words words words words words words words words words words words
350
290
  words words words words words words words words words words words words words
351
- words words words words
291
+ words words words words
352
292
  EXPECTED
353
293
 
354
294
  assert_equal expected, @to.end_accepting
355
295
  end
356
296
 
357
- def test_accept_rule_indent
358
- @to.start_accepting
359
- @to.indent = 3
360
-
361
- @to.accept_rule @RM::Rule.new(1)
362
-
297
+ def accept_rule_indent
363
298
  assert_equal " #{'-' * 75}\n", @to.end_accepting
364
299
  end
365
300
 
366
- def test_accept_verbatim_indent
367
- @to.start_accepting
368
-
369
- @to.indent = 2
370
-
371
- @to.accept_verbatim @RM::Verbatim.new(' ', 'hi', "\n",
372
- ' ', 'world', "\n")
373
-
301
+ def accept_verbatim_indent
374
302
  assert_equal " hi\n world\n\n", @to.end_accepting
375
303
  end
376
304
 
377
- def test_accept_verbatim_big_indent
378
- @to.start_accepting
379
-
380
- @to.indent = 2
381
-
382
- @to.accept_verbatim @RM::Verbatim.new(' ', 'hi', "\n",
383
- ' ', 'world', "\n")
384
-
305
+ def accept_verbatim_big_indent
385
306
  assert_equal " hi\n world\n\n", @to.end_accepting
386
307
  end
387
308
 
388
- def test_attributes
389
- assert_equal 'Dog', @to.attributes("\\Dog")
390
- end
391
-
392
- def test_list_nested
393
- doc = @RM::Document.new(
394
- @RM::List.new(:BULLET,
395
- @RM::ListItem.new(nil,
396
- @RM::Paragraph.new('l1'),
397
- @RM::List.new(:BULLET,
398
- @RM::ListItem.new(nil,
399
- @RM::Paragraph.new('l1.1')))),
400
- @RM::ListItem.new(nil,
401
- @RM::Paragraph.new('l2'))))
402
-
403
- output = doc.accept @to
404
-
309
+ def list_nested
405
310
  expected = <<-EXPECTED
406
311
  * l1
407
312
  * l1.1
408
313
  * l2
409
314
  EXPECTED
410
315
 
411
- assert_equal expected, output
412
- end
413
-
414
- def test_list_verbatim # HACK overblown
415
- doc = @RM::Document.new(
416
- @RM::List.new(:BULLET,
417
- @RM::ListItem.new(nil,
418
- @RM::Paragraph.new('list', 'stuff'),
419
- @RM::BlankLine.new(),
420
- @RM::Verbatim.new(' ', '*', ' ', 'list', "\n",
421
- ' ', 'with', "\n",
422
- "\n",
423
- ' ', 'second', "\n",
424
- "\n",
425
- ' ', '1.', ' ', 'indented', "\n",
426
- ' ', '2.', ' ', 'numbered', "\n",
427
- "\n",
428
- ' ', 'third', "\n",
429
- "\n",
430
- ' ', '*', ' ', 'second', "\n"))))
431
-
432
- output = doc.accept @to
316
+ assert_equal expected, @to.end_accepting
317
+ end
433
318
 
434
- expected = <<-EXPECTED
319
+ def list_verbatim
320
+ expected = <<-EXPECTED # HACK overblown
435
321
  * list stuff
436
322
 
437
323
  * list
@@ -448,7 +334,7 @@ words words words words
448
334
 
449
335
  EXPECTED
450
336
 
451
- assert_equal expected, output
337
+ assert_equal expected, @to.end_accepting
452
338
  end
453
339
 
454
340
  end