rdoc 3.5.3 → 3.6

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.

@@ -625,6 +625,25 @@ for all good men
625
625
  assert_equal expected, @RMP.parse(str).parts
626
626
  end
627
627
 
628
+ def test_parse_rule
629
+ str = <<-STR
630
+ now is the time
631
+
632
+ ---
633
+
634
+ for all good men
635
+ STR
636
+
637
+ expected = [
638
+ @RM::Paragraph.new('now is the time'),
639
+ @RM::BlankLine.new,
640
+ @RM::Rule.new(1),
641
+ @RM::BlankLine.new,
642
+ @RM::Paragraph.new('for all good men')]
643
+
644
+ assert_equal expected, @RMP.parse(str).parts
645
+ end
646
+
628
647
  def test_parse_ualpha
629
648
  str = <<-STR
630
649
  A. l1
@@ -17,26 +17,16 @@ class TestRDocOptions < MiniTest::Unit::TestCase
17
17
  end
18
18
 
19
19
  def test_check_files
20
+ skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
20
21
  out, err = capture_io do
21
22
  Dir.mktmpdir do |dir|
22
- begin
23
- unreadable = nil # variable for windows
24
-
25
- Dir.chdir dir do
26
- if RUBY_PLATFORM =~ /mswin|mingw/ then
27
- unreadable = open 'unreadable'
28
- File.delete 'unreadable'
29
- else
30
- FileUtils.touch 'unreadable'
31
- FileUtils.chmod 0, 'unreadable'
32
- end
33
-
34
- @options.files = %w[nonexistent unreadable]
35
-
36
- @options.check_files
37
- end
38
- ensure
39
- unreadable.close if unreadable
23
+ Dir.chdir dir do
24
+ FileUtils.touch 'unreadable'
25
+ FileUtils.chmod 0, 'unreadable'
26
+
27
+ @options.files = %w[nonexistent unreadable]
28
+
29
+ @options.check_files
40
30
  end
41
31
  end
42
32
  end
@@ -680,7 +680,7 @@ Init_Foo(void) {
680
680
 
681
681
  baz = methods.last
682
682
  assert_equal 'Foo#baz', baz.full_name
683
- assert_equal "a comment for bar", bar.comment
683
+ assert_equal "a comment for bar", baz.comment
684
684
  end
685
685
 
686
686
  def test_find_modifiers_call_seq
@@ -911,6 +911,37 @@ rb_io_s_read(argc, argv, io)
911
911
  {
912
912
  }
913
913
 
914
+ void
915
+ Init_IO(void) {
916
+ /*
917
+ * a comment for class Foo on rb_define_class
918
+ */
919
+ VALUE rb_cIO = rb_define_class("IO", rb_cObject);
920
+ rb_define_singleton_method(rb_cIO, "read", rb_io_s_read, -1);
921
+ }
922
+ EOF
923
+
924
+ klass = util_get_class content, 'rb_cIO'
925
+ read_method = klass.method_list.first
926
+ assert_equal "read", read_method.name
927
+ assert_equal "Method Comment! ", read_method.comment
928
+ assert_equal "rb_io_s_read", read_method.c_function
929
+ assert read_method.singleton
930
+ end
931
+
932
+ def test_define_method_with_prototype
933
+ content = <<-EOF
934
+ static VALUE rb_io_s_read(int, VALUE*, VALUE);
935
+
936
+ /* Method Comment! */
937
+ static VALUE
938
+ rb_io_s_read(argc, argv, io)
939
+ int argc;
940
+ VALUE *argv;
941
+ VALUE io;
942
+ {
943
+ }
944
+
914
945
  void
915
946
  Init_IO(void) {
916
947
  /*
@@ -1799,6 +1799,56 @@ EOF
1799
1799
  assert_equal :private, foo.visibility
1800
1800
  end
1801
1801
 
1802
+ def test_parse_statements_identifier_public_class_method
1803
+ content = <<-CONTENT
1804
+ class Date
1805
+ def self.now; end
1806
+ private_class_method :now
1807
+ end
1808
+
1809
+ class DateTime < Date
1810
+ public_class_method :now
1811
+ end
1812
+ CONTENT
1813
+
1814
+ util_parser content
1815
+
1816
+ @parser.parse_statements @top_level
1817
+
1818
+ date, date_time = @top_level.classes
1819
+
1820
+ date_now = date.method_list.first
1821
+ date_time_now = date_time.method_list.first
1822
+
1823
+ assert_equal :private, date_now.visibility
1824
+ assert_equal :public, date_time_now.visibility
1825
+ end
1826
+
1827
+ def test_parse_statements_identifier_private_class_method
1828
+ content = <<-CONTENT
1829
+ class Date
1830
+ def self.now; end
1831
+ public_class_method :now
1832
+ end
1833
+
1834
+ class DateTime < Date
1835
+ private_class_method :now
1836
+ end
1837
+ CONTENT
1838
+
1839
+ util_parser content
1840
+
1841
+ @parser.parse_statements @top_level
1842
+
1843
+ date, date_time = @top_level.classes
1844
+
1845
+ date_now = date.method_list.first
1846
+ date_time_now = date_time.method_list.first
1847
+
1848
+ assert_equal :public, date_now.visibility, date_now.full_name
1849
+ assert_equal :private, date_time_now.visibility, date_time_now.full_name
1850
+ end
1851
+
1802
1852
  def test_parse_statements_identifier_require
1803
1853
  content = "require 'bar'"
1804
1854
 
@@ -1978,6 +2028,53 @@ end
1978
2028
  assert_equal 'm comment', m.comment
1979
2029
  end
1980
2030
 
2031
+ def test_scan_block_comment_notflush
2032
+ ##
2033
+ #
2034
+ # The previous test assumes that between the =begin/=end blocs that there is
2035
+ # only one line, or minima formatting directives. This test tests for those
2036
+ # who use the =begin bloc with longer / more advanced formatting within.
2037
+ #
2038
+ ##
2039
+ content = <<-CONTENT
2040
+ =begin rdoc
2041
+
2042
+ = DESCRIPTION
2043
+
2044
+ This is a simple test class
2045
+
2046
+ = RUMPUS
2047
+
2048
+ Is a silly word
2049
+
2050
+ =end
2051
+ class StevenSimpleClass
2052
+ # A band on my iPhone as I wrote this test
2053
+ FRUIT_BATS="Make nice music"
2054
+
2055
+ =begin rdoc
2056
+ A nice girl
2057
+ =end
2058
+
2059
+ def lauren
2060
+ puts "Summoning Lauren!"
2061
+ end
2062
+ end
2063
+ CONTENT
2064
+ util_parser content
2065
+
2066
+ @parser.scan
2067
+
2068
+ foo = @top_level.classes.first
2069
+
2070
+ assert_equal "= DESCRIPTION\n\nThis is a simple test class\n\n= RUMPUS\n\nIs a silly word",
2071
+ foo.comment
2072
+
2073
+ m = foo.method_list.first
2074
+
2075
+ assert_equal 'A nice girl', m.comment
2076
+ end
2077
+
1981
2078
  def test_scan_meta_method_block
1982
2079
  content = <<-CONTENT
1983
2080
  class C
@@ -3,6 +3,7 @@ require 'rubygems'
3
3
  require 'minitest/autorun'
4
4
  require 'tmpdir'
5
5
  require 'fileutils'
6
+ require 'stringio'
6
7
  require 'rdoc/ri/driver'
7
8
 
8
9
  class TestRDocRIDriver < MiniTest::Unit::TestCase
@@ -249,12 +250,14 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
249
250
 
250
251
  @driver.stores = [store]
251
252
 
252
- assert_equal %w[Foo Foo::Bar], @driver.complete('F')
253
+ assert_equal %w[Foo ], @driver.complete('F')
253
254
  assert_equal %w[ Foo::Bar], @driver.complete('Foo::B')
254
255
 
255
- assert_equal %w[Foo#Bar], @driver.complete('Foo#'), 'Foo#'
256
- assert_equal %w[Foo#Bar Foo::bar], @driver.complete('Foo.'), 'Foo.'
257
- assert_equal %w[Foo::Bar Foo::bar], @driver.complete('Foo::'), 'Foo::'
256
+ assert_equal %w[Foo#Bar], @driver.complete('Foo#'), 'Foo#'
257
+ assert_equal %w[Foo#Bar Foo::bar], @driver.complete('Foo.'), 'Foo.'
258
+ assert_equal %w[Foo::Bar Foo::bar], @driver.complete('Foo::'), 'Foo::'
259
+
260
+ assert_equal %w[ Foo::bar], @driver.complete('Foo::b'), 'Foo::b'
258
261
  end
259
262
 
260
263
  def test_complete_ancestor
@@ -269,7 +272,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
269
272
  def test_complete_classes
270
273
  util_store
271
274
 
272
- assert_equal %w[Foo Foo::Bar Foo::Baz], @driver.complete('F')
275
+ assert_equal %w[Foo ], @driver.complete('F')
273
276
  assert_equal %w[Foo:: Foo::Bar Foo::Baz], @driver.complete('Foo::')
274
277
  assert_equal %w[ Foo::Bar Foo::Baz], @driver.complete('Foo::B')
275
278
  end
@@ -278,7 +281,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
278
281
  util_multi_store
279
282
 
280
283
  assert_equal %w[Bar], @driver.complete('B')
281
- assert_equal %w[Foo Foo::Bar Foo::Baz], @driver.complete('F')
284
+ assert_equal %w[Foo], @driver.complete('F')
285
+ assert_equal %w[Foo::Bar Foo::Baz], @driver.complete('Foo::B')
282
286
  end
283
287
 
284
288
  def test_display
@@ -572,11 +576,18 @@ Foo::Bar#bother
572
576
  def test_name_regexp
573
577
  assert_equal %r%^RDoc::AnyMethod#new$%,
574
578
  @driver.name_regexp('RDoc::AnyMethod#new')
579
+
575
580
  assert_equal %r%^RDoc::AnyMethod::new$%,
576
581
  @driver.name_regexp('RDoc::AnyMethod::new')
577
582
 
578
583
  assert_equal %r%^RDoc::AnyMethod(#|::)new$%,
579
584
  @driver.name_regexp('RDoc::AnyMethod.new')
585
+
586
+ assert_equal %r%^Hash(#|::)\[\]$%,
587
+ @driver.name_regexp('Hash.[]')
588
+
589
+ assert_equal %r%^Hash::\[\]$%,
590
+ @driver.name_regexp('Hash::[]')
580
591
  end
581
592
 
582
593
  def test_list_known_classes
@@ -589,6 +600,16 @@ Foo::Bar#bother
589
600
  assert_equal "Ambiguous\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
590
601
  end
591
602
 
603
+ def test_list_known_classes_name
604
+ util_store
605
+
606
+ out, = capture_io do
607
+ @driver.list_known_classes %w[F I]
608
+ end
609
+
610
+ assert_equal "Foo\nFoo::Bar\nFoo::Baz\nInc\n", out
611
+ end
612
+
592
613
  def test_list_methods_matching
593
614
  util_store
594
615
 
@@ -596,6 +617,24 @@ Foo::Bar#bother
596
617
  @driver.list_methods_matching('Foo::Bar.')
597
618
  end
598
619
 
620
+ def test_list_methods_matching_regexp
621
+ util_store
622
+
623
+ index = RDoc::AnyMethod.new nil, '[]'
624
+ @cFoo.add_method index
625
+ @store.save_method @cFoo, index
626
+
627
+ c_index = RDoc::AnyMethod.new nil, '[]'
628
+ c_index.singleton = true
629
+ @cFoo.add_method c_index
630
+ @store.save_method @cFoo, c_index
631
+
632
+ @store.save_cache
633
+
634
+ assert_equal %w[Foo#[]], @driver.list_methods_matching('Foo#[]')
635
+ assert_equal %w[Foo::[]], @driver.list_methods_matching('Foo::[]')
636
+ end
637
+
599
638
  def test_load_method
600
639
  util_store
601
640
 
@@ -12,7 +12,10 @@ class TestRDocTopLevel < XrefTestCase
12
12
 
13
13
  def test_class_all_classes_and_modules
14
14
  expected = %w[
15
- C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 M1 M1::M2
15
+ C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
16
+ Child
17
+ M1 M1::M2
18
+ Parent
16
19
  ]
17
20
 
18
21
  assert_equal expected,
@@ -22,6 +25,7 @@ class TestRDocTopLevel < XrefTestCase
22
25
  def test_class_classes
23
26
  expected = %w[
24
27
  C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
28
+ Child Parent
25
29
  ]
26
30
 
27
31
  assert_equal expected, RDoc::TopLevel.classes.map { |m| m.full_name }.sort
@@ -63,5 +63,14 @@ end
63
63
 
64
64
  module M1::M2
65
65
  end
66
+
67
+ class Parent
68
+ def m() end
69
+ def self.m() end
70
+ end
71
+
72
+ class Child < Parent
73
+ end
74
+
66
75
  XREF_DATA
67
76
 
@@ -38,7 +38,6 @@ class XrefTestCase < MiniTest::Unit::TestCase
38
38
  @c1_m = @c1.method_list.last # C1#m
39
39
  @c1__m = @c1.method_list.first # C1::m
40
40
 
41
-
42
41
  @c2 = @xref_data.find_module_named 'C2'
43
42
  @c2_a = @c2.method_list.last
44
43
  @c2_b = @c2.method_list.first
@@ -55,6 +54,12 @@ class XrefTestCase < MiniTest::Unit::TestCase
55
54
  @m1_m = @m1.method_list.first
56
55
 
57
56
  @m1_m2 = @xref_data.find_module_named 'M1::M2'
57
+
58
+ @parent = @xref_data.find_module_named 'Parent'
59
+ @child = @xref_data.find_module_named 'Child'
60
+
61
+ @parent_m = @parent.method_list.first # Parent#m
62
+ @parent__m = @parent.method_list.last # Parent::m
58
63
  end
59
64
 
60
65
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
- - 5
9
- - 3
10
- version: 3.5.3
8
+ - 6
9
+ version: "3.6"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Eric Hodel
@@ -39,8 +38,7 @@ cert_chain:
39
38
  x52qPcexcYZR7w==
40
39
  -----END CERTIFICATE-----
41
40
 
42
- date: 2011-02-06 00:00:00 -08:00
43
- default_executable:
41
+ date: 2011-05-14 00:00:00 Z
44
42
  dependencies:
45
43
  - !ruby/object:Gem::Dependency
46
44
  name: minitest
@@ -108,12 +106,12 @@ dependencies:
108
106
  requirements:
109
107
  - - ">="
110
108
  - !ruby/object:Gem::Version
111
- hash: 43
109
+ hash: 35
112
110
  segments:
113
111
  - 2
114
112
  - 9
115
- - 0
116
- version: 2.9.0
113
+ - 4
114
+ version: 2.9.4
117
115
  type: :development
118
116
  version_requirements: *id005
119
117
  description: |-
@@ -306,33 +304,10 @@ files:
306
304
  - test/xref_data.rb
307
305
  - test/xref_test_case.rb
308
306
  - .gemtest
309
- has_rdoc: true
310
- homepage: http://rdoc.rubyforge.org
307
+ homepage: http://docs.seattlerb.org/rdoc
311
308
  licenses: []
312
309
 
313
- post_install_message: |
314
- NOTE: If you are running Ruby 1.9.2 you can ignore this message.
315
-
316
- RDoc 2.5+ has a new ri data format for Ruby 1.8.7 and 1.9.1. (1.9.2 contains
317
- RDoc 2.5 so there is nothing to do!)
318
-
319
- To install new ri data for core and stdlib you'll need to:
320
-
321
- gem install rdoc-data
322
-
323
- then run:
324
-
325
- rdoc-data --install
326
-
327
- To have ri data for you gems you'll also need to run:
328
-
329
- gem rdoc --all --overwrite
330
-
331
- If you don't want to rebuild the rdoc for `gem server`, add --no-rdoc.
332
-
333
- NOTE: RDoc 2.5 did not save method parameters, so you should upgrade your
334
- rdoc-data gem to a version >= 2.5.3 if you installed an older version.
335
-
310
+ post_install_message:
336
311
  rdoc_options:
337
312
  - --main
338
313
  - README.txt
@@ -362,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
337
  requirements: []
363
338
 
364
339
  rubyforge_project: rdoc
365
- rubygems_version: 1.5.0
340
+ rubygems_version: 1.8.2
366
341
  signing_key:
367
342
  specification_version: 3
368
343
  summary: RDoc produces HTML and command-line documentation for Ruby projects