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
@@ -12,13 +12,6 @@ class TestRDocMarkupParser < RDoc::TestCase
12
12
  @RMP = @RM::Parser
13
13
  end
14
14
 
15
- def mu_pp(obj)
16
- s = ''
17
- s = PP.pp obj, s
18
- s = s.force_encoding(Encoding.default_external) if @have_encoding
19
- s.chomp
20
- end
21
-
22
15
  def test_build_heading
23
16
  parser = @RMP.new
24
17
 
@@ -11,7 +11,7 @@ class TestRDocMarkupPreProcess < RDoc::TestCase
11
11
  @file_name = File.basename @tempfile.path
12
12
  @dir = File.dirname @tempfile.path
13
13
 
14
- @pp = RDoc::Markup::PreProcess.new __FILE__, [@dir]
14
+ @pp = RDoc::Markup::PreProcess.new @tempfile.path, [@dir, File.dirname(__FILE__)]
15
15
  end
16
16
 
17
17
  def teardown
@@ -72,6 +72,18 @@ contents of a string.
72
72
  assert_equal expected, content
73
73
  end
74
74
 
75
+ def test_include_file_in_other_directory
76
+ content = nil
77
+ out, err = capture_io do
78
+ content = @pp.include_file "test.txt", '', nil
79
+ end
80
+
81
+ assert_empty out
82
+ assert_empty err
83
+
84
+ assert_equal "test file\n", content
85
+ end
86
+
75
87
  def test_handle
76
88
  text = "# :main: M\n"
77
89
  out = @pp.handle text
@@ -135,7 +147,7 @@ contents of a string.
135
147
  def test_handle_directive_blankline
136
148
  result = @pp.handle_directive '#', 'arg', 'a, b'
137
149
 
138
- assert_equal "#\n", result
150
+ assert_equal "#:arg: a, b\n", result
139
151
  end
140
152
 
141
153
  def test_handle_directive_downcase
@@ -157,7 +169,7 @@ contents of a string.
157
169
  def test_handle_directive_arg_no_context
158
170
  result = @pp.handle_directive '', 'arg', 'a, b', nil
159
171
 
160
- assert_equal "\n", result
172
+ assert_equal ":arg: a, b\n", result
161
173
  end
162
174
 
163
175
  def test_handle_directive_args
@@ -8,13 +8,6 @@ class TestRDocMarkupRaw < RDoc::TestCase
8
8
  @p = @RM::Raw.new
9
9
  end
10
10
 
11
- def mu_pp obj
12
- s = ''
13
- s = PP.pp obj, s
14
- s.force_encoding Encoding.default_external if defined? Encoding
15
- s.chomp
16
- end
17
-
18
11
  def test_push
19
12
  @p.push 'hi', 'there'
20
13
 
@@ -288,7 +288,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
288
288
  end
289
289
 
290
290
  def accept_rule
291
- assert_equal "<hr style=\"height: 4px\">\n", @to.res.join
291
+ assert_equal "<hr>\n", @to.res.join
292
292
  end
293
293
 
294
294
  def accept_verbatim
@@ -357,12 +357,12 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
357
357
  @to.code_object = RDoc::NormalClass.new 'Foo'
358
358
  @to.start_accepting
359
359
 
360
- @to.accept_heading @RM::Heading.new(1, 'Hello')
360
+ @to.accept_heading head(1, 'Hello')
361
361
 
362
- links = '<span><a href="#label-Hello">&para;</a> ' +
362
+ links = '<span><a href="#class-Foo-label-Hello">&para;</a> ' +
363
363
  '<a href="#documentation">&uarr;</a></span>'
364
364
 
365
- assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n",
365
+ assert_equal "\n<h1 id=\"class-Foo-label-Hello\">Hello#{links}</h1>\n",
366
366
  @to.res.join
367
367
  end
368
368
 
@@ -397,6 +397,27 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
397
397
  assert_equal "\n<p>hello world</p>\n", @to.res.join
398
398
  end
399
399
 
400
+ def test_accept_heading_output_decoration
401
+ @options.output_decoration = false
402
+
403
+ @to.start_accepting
404
+
405
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
406
+
407
+ assert_equal "\n<h1>Hello<span><a href=\"#label-Hello\">&para;</a> <a href=\"#documentation\">&uarr;</a></span></h1>\n", @to.res.join
408
+ end
409
+
410
+ def test_accept_heading_output_decoration_with_pipe
411
+ @options.pipe = true
412
+ @options.output_decoration = false
413
+
414
+ @to.start_accepting
415
+
416
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
417
+
418
+ assert_equal "\n<h1>Hello</h1>\n", @to.res.join
419
+ end
420
+
400
421
  def test_accept_verbatim_parseable
401
422
  verb = @RM::Verbatim.new("class C\n", "end\n")
402
423
 
@@ -483,13 +504,13 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
483
504
  def test_convert_RDOCLINK_label_foottext
484
505
  result = @to.convert 'rdoc-label:foottext-1'
485
506
 
486
- assert_equal "\n<p><a href=\"#foottext-1\">*1</a></p>\n", result
507
+ assert_equal "\n<p><a href=\"#foottext-1\">1</a></p>\n", result
487
508
  end
488
509
 
489
510
  def test_convert_RDOCLINK_label_footmark
490
511
  result = @to.convert 'rdoc-label:footmark-1'
491
512
 
492
- assert_equal "\n<p><a href=\"#footmark-1\">^1</a></p>\n", result
513
+ assert_equal "\n<p><a href=\"#footmark-1\">1</a></p>\n", result
493
514
  end
494
515
 
495
516
  def test_convert_RDOCLINK_ref
@@ -501,7 +522,28 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
501
522
  def test_convert_TIDYLINK_footnote
502
523
  result = @to.convert 'text{*1}[rdoc-label:foottext-1:footmark-1]'
503
524
 
504
- assert_equal "\n<p>text<a id=\"footmark-1\" href=\"#foottext-1\">*1</a></p>\n", result
525
+ assert_equal "\n<p>text<sup><a id=\"footmark-1\" href=\"#foottext-1\">1</a></sup></p>\n", result
526
+ end
527
+
528
+ def test_convert_TIDYLINK_multiple
529
+ result = @to.convert '{a}[http://example] {b}[http://example]'
530
+
531
+ expected = <<-EXPECTED
532
+
533
+ <p><a href=\"http://example\">a</a> <a href=\"http://example\">b</a></p>
534
+ EXPECTED
535
+
536
+ assert_equal expected, result
537
+ end
538
+
539
+ def test_convert_TIDYLINK_image
540
+ result =
541
+ @to.convert '{rdoc-image:path/to/image.jpg}[http://example.com]'
542
+
543
+ expected =
544
+ "\n<p><a href=\"http://example.com\"><img src=\"path/to/image.jpg\"></a></p>\n"
545
+
546
+ assert_equal expected, result
505
547
  end
506
548
 
507
549
  def test_convert_TIDYLINK_rdoc_label
@@ -527,7 +569,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
527
569
  end
528
570
 
529
571
  def test_gen_url_rdoc_label_id
530
- assert_equal '<a id="footmark-1" href="#foottext-1">example</a>',
572
+ assert_equal '<sup><a id="footmark-1" href="#foottext-1">example</a></sup>',
531
573
  @to.gen_url('rdoc-label:foottext-1:footmark-1', 'example')
532
574
  end
533
575
 
@@ -36,6 +36,13 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
36
36
  result
37
37
  end
38
38
 
39
+ def test_convert_CROSSREF_section
40
+ @c1.add_section 'Section'
41
+
42
+ result = @to.convert 'C1@Section'
43
+ assert_equal para("<a href=\"C1.html#Section\">Section at C1</a>"), result
44
+ end
45
+
39
46
  def test_convert_RDOCLINK_rdoc_ref
40
47
  result = @to.convert 'rdoc-ref:C1'
41
48
 
@@ -626,15 +626,15 @@ This routine modifies its +comment+ parameter.
626
626
  def test_convert_RDOCLINK_label_foottext
627
627
  result = @to.convert 'rdoc-label:foottext-1'
628
628
 
629
- assert_equal "<p>*1\n", result
630
- assert_equal 2, @to.characters
629
+ assert_equal "<p>1\n", result
630
+ assert_equal 1, @to.characters
631
631
  end
632
632
 
633
633
  def test_convert_RDOCLINK_label_footmark
634
634
  result = @to.convert 'rdoc-label:footmark-1'
635
635
 
636
- assert_equal "<p>^1\n", result
637
- assert_equal 2, @to.characters
636
+ assert_equal "<p>1\n", result
637
+ assert_equal 1, @to.characters
638
638
  end
639
639
 
640
640
  def test_convert_RDOCLINK_ref
@@ -354,6 +354,12 @@ words words words words
354
354
  assert_equal "C\n", result
355
355
  end
356
356
 
357
+ def test_convert_RDOCLINK_image
358
+ result = @to.convert 'rdoc-image:/path/to/image.jpg'
359
+
360
+ assert_equal "![](/path/to/image.jpg)\n", result
361
+ end
362
+
357
363
  def test_convert_TIDYLINK
358
364
  result = @to.convert \
359
365
  '{DSL}[http://en.wikipedia.org/wiki/Domain-specific_language]'
@@ -2,6 +2,10 @@ require File.expand_path '../xref_test_case', __FILE__
2
2
 
3
3
  class TestRDocMethodAttr < XrefTestCase
4
4
 
5
+ def test_initialize_copy
6
+ refute_same @c1_m.full_name, @c1_m.dup.full_name
7
+ end
8
+
5
9
  def test_block_params_equal
6
10
 
7
11
  m = RDoc::MethodAttr.new(nil, 'foo')
@@ -116,6 +120,10 @@ class TestRDocMethodAttr < XrefTestCase
116
120
  assert_equal 'C1::m', @c1__m.full_name
117
121
  end
118
122
 
123
+ def test_is_alias_for
124
+ assert_equal @c2_b, @c2_a.is_alias_for
125
+ end
126
+
119
127
  def test_output_name
120
128
  assert_equal '#m', @c1_m.output_name(@c1)
121
129
  assert_equal '::m', @c1__m.output_name(@c1)
@@ -21,6 +21,11 @@ class TestRDocNormalClass < XrefTestCase
21
21
  assert_equal [c2, c1, 'Object'], c3.ancestors
22
22
  end
23
23
 
24
+ def test_aref
25
+ assert_equal 'class-C1', @c1.aref
26
+ assert_equal 'class-C2::C3', @c2_c3.aref
27
+ end
28
+
24
29
  def test_direct_ancestors
25
30
  incl = RDoc::Include.new 'Incl', ''
26
31
 
@@ -23,6 +23,11 @@ class TestRDocNormalModule < XrefTestCase
23
23
  assert_equal [mod2, incl.name], mod.ancestors
24
24
  end
25
25
 
26
+ def test_aref
27
+ assert_equal 'module-M1', @m1.aref
28
+ assert_equal 'module-M1::M2', @m1_m2.aref
29
+ end
30
+
26
31
  def test_definition
27
32
  m = RDoc::NormalModule.new 'M'
28
33
 
@@ -15,13 +15,6 @@ class TestRDocOptions < RDoc::TestCase
15
15
  RDoc::RDoc::GENERATORS.replace @generators
16
16
  end
17
17
 
18
- def mu_pp obj
19
- s = ''
20
- s = PP.pp obj, s
21
- s = s.force_encoding Encoding.default_external if defined? Encoding
22
- s.chomp
23
- end
24
-
25
18
  def test_check_files
26
19
  skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
27
20
 
@@ -69,21 +62,23 @@ class TestRDocOptions < RDoc::TestCase
69
62
  encoding = Object.const_defined?(:Encoding) ? 'UTF-8' : nil
70
63
 
71
64
  expected = {
72
- 'charset' => 'UTF-8',
73
- 'encoding' => encoding,
74
- 'exclude' => [],
75
- 'hyperlink_all' => false,
76
- 'line_numbers' => false,
77
- 'main_page' => nil,
78
- 'markup' => 'rdoc',
79
- 'page_dir' => nil,
80
- 'rdoc_include' => [],
81
- 'show_hash' => false,
82
- 'static_path' => [],
83
- 'tab_width' => 8,
84
- 'title' => nil,
85
- 'visibility' => :protected,
86
- 'webcvs' => nil,
65
+ 'charset' => 'UTF-8',
66
+ 'encoding' => encoding,
67
+ 'exclude' => [],
68
+ 'hyperlink_all' => false,
69
+ 'line_numbers' => false,
70
+ 'main_page' => nil,
71
+ 'markup' => 'rdoc',
72
+ 'output_decoration' => true,
73
+ 'page_dir' => nil,
74
+ 'rdoc_include' => [],
75
+ 'show_hash' => false,
76
+ 'static_path' => [],
77
+ 'tab_width' => 8,
78
+ 'template_stylesheets' => [],
79
+ 'title' => nil,
80
+ 'visibility' => :protected,
81
+ 'webcvs' => nil,
87
82
  }
88
83
 
89
84
  assert_equal expected, coder
@@ -533,6 +528,27 @@ rdoc_include:
533
528
  assert_empty err
534
529
 
535
530
  assert_equal Pathname(Dir.tmpdir), @options.root
531
+ assert_includes @options.rdoc_include, @options.root.to_s
532
+ end
533
+
534
+ def test_parse_tab_width
535
+ @options.parse %w[--tab-width=1]
536
+ assert_equal 1, @options.tab_width
537
+
538
+ @options.parse %w[-w2]
539
+ assert_equal 2, @options.tab_width
540
+
541
+ _, err = capture_io do
542
+ @options.parse %w[-w=2]
543
+ end
544
+
545
+ assert_match 'invalid options', err
546
+
547
+ _, err = capture_io do
548
+ @options.parse %w[-w0]
549
+ end
550
+
551
+ assert_match 'invalid options', err
536
552
  end
537
553
 
538
554
  def test_parse_template
@@ -586,6 +602,20 @@ rdoc_include:
586
602
  $LOAD_PATH.replace orig_LOAD_PATH
587
603
  end
588
604
 
605
+ def test_parse_visibility
606
+ @options.parse %w[--visibility=public]
607
+ assert_equal :public, @options.visibility
608
+
609
+ @options.parse %w[--visibility=protected]
610
+ assert_equal :protected, @options.visibility
611
+
612
+ @options.parse %w[--visibility=private]
613
+ assert_equal :private, @options.visibility
614
+
615
+ @options.parse %w[--visibility=nodoc]
616
+ assert_equal :nodoc, @options.visibility
617
+ end
618
+
589
619
  def test_parse_write_options
590
620
  tmpdir = File.join Dir.tmpdir, "test_rdoc_options_#{$$}"
591
621
  FileUtils.mkdir_p tmpdir
@@ -702,6 +732,15 @@ rdoc_include:
702
732
  end
703
733
 
704
734
  assert out.include?(RDoc::VERSION)
735
+
736
+ out, _ = capture_io do
737
+ begin
738
+ @options.parse %w[-v]
739
+ rescue SystemExit
740
+ end
741
+ end
742
+
743
+ assert out.include?(RDoc::VERSION)
705
744
  end
706
745
 
707
746
  end
@@ -292,6 +292,16 @@ class TestRDocParser < RDoc::TestCase
292
292
  assert_nil parser
293
293
  end
294
294
 
295
+ def test_class_use_markup_unknown
296
+ content = <<-CONTENT
297
+ # :markup: RDoc
298
+ CONTENT
299
+
300
+ parser = @RP.use_markup content
301
+
302
+ assert_nil parser
303
+ end
304
+
295
305
  def test_initialize
296
306
  @RP.new @top_level, @fn, '', @options, nil
297
307
 
@@ -534,10 +534,6 @@ void Init_curses(){
534
534
  def test_do_constants_file
535
535
  content = <<-EOF
536
536
  void Init_File(void) {
537
- rb_cFile = rb_define_class("File", rb_cIO);
538
- rb_mFConst = rb_define_module_under(rb_cFile, "Constants");
539
- rb_include_module(rb_cIO, rb_mFConst);
540
-
541
537
  /* Document-const: LOCK_SH
542
538
  *
543
539
  * Shared lock
@@ -1722,7 +1718,7 @@ path_to_s(VALUE self) { }
1722
1718
  */
1723
1719
  static VALUE
1724
1720
  path_aref_m(int argc, VALUE *argv, VALUE str) { }
1725
-
1721
+
1726
1722
  /*
1727
1723
  * call-seq:
1728
1724
  * string <=> other_string -> -1, 0, +1 or nil
@@ -1730,6 +1726,14 @@ path_aref_m(int argc, VALUE *argv, VALUE str) { }
1730
1726
  static VALUE
1731
1727
  path_cmp_m(VALUE str1, VALUE str2) { }
1732
1728
 
1729
+ /*
1730
+ * call-seq:
1731
+ * str == obj -> true or false
1732
+ * str === obj -> true or false
1733
+ */
1734
+ VALUE
1735
+ rb_str_equal(VALUE str1, VALUE str2) { }
1736
+
1733
1737
  Init_pathname()
1734
1738
  {
1735
1739
  rb_cPathname = rb_define_class("Pathname", rb_cObject);
@@ -1739,6 +1743,8 @@ Init_pathname()
1739
1743
  rb_define_method(rb_cPathname, "[]", path_aref_m, -1);
1740
1744
  rb_define_method(rb_cPathname, "slice", path_aref_m, -1);
1741
1745
  rb_define_method(rb_cPathname, "<=>", path_cmp_m, 1);
1746
+ rb_define_method(rb_cPathname, "==", rb_str_equal), 2);
1747
+ rb_define_method(rb_cPathname, "===", rb_str_equal), 2);
1742
1748
  }
1743
1749
  C
1744
1750
 
@@ -1771,6 +1777,12 @@ str.slice(start, length) -> new_str or nil
1771
1777
  spaceship = pathname.method_list.find { |m| m.name == '<=>' }
1772
1778
  assert_equal "string <=> other_string -> -1, 0, +1 or nil",
1773
1779
  spaceship.call_seq
1780
+
1781
+ equals2 = pathname.method_list.find { |m| m.name == '==' }
1782
+ assert_match 'str == obj', equals2.call_seq
1783
+
1784
+ equals3 = pathname.method_list.find { |m| m.name == '===' }
1785
+ assert_match 'str === obj', equals3.call_seq
1774
1786
  end
1775
1787
 
1776
1788
  def test_scan_order_dependent