rdoc 3.4 → 3.5

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.

@@ -32,6 +32,36 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
32
32
  @tempfile2.close
33
33
  end
34
34
 
35
+ def test_collect_first_comment
36
+ p = util_parser <<-CONTENT
37
+ # first
38
+
39
+ # second
40
+ class C; end
41
+ CONTENT
42
+
43
+ comment = p.collect_first_comment
44
+
45
+ assert_equal "# first\n", comment
46
+ end
47
+
48
+ def test_collect_first_comment_encoding
49
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
50
+
51
+ @options.encoding = Encoding::CP852
52
+
53
+ p = util_parser <<-CONTENT
54
+ # first
55
+
56
+ # second
57
+ class C; end
58
+ CONTENT
59
+
60
+ comment = p.collect_first_comment
61
+
62
+ assert_equal Encoding::CP852, comment.encoding
63
+ end
64
+
35
65
  def test_extract_call_seq
36
66
  m = RDoc::AnyMethod.new nil, 'm'
37
67
  p = util_parser ''
@@ -156,6 +186,42 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
156
186
  assert_equal expected, comment
157
187
  end
158
188
 
189
+ def test_remove_private_comments_encoding
190
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
191
+
192
+ util_parser ''
193
+
194
+ comment = <<-EOS
195
+ # This is text
196
+ #--
197
+ # this is private
198
+ EOS
199
+ comment.force_encoding Encoding::IBM437
200
+
201
+ @parser.remove_private_comments comment
202
+
203
+ assert_equal Encoding::IBM437, comment.encoding
204
+ end
205
+
206
+ def test_remove_private_comments_long
207
+ util_parser ''
208
+
209
+ comment = <<-EOS
210
+ #-----
211
+ #++
212
+ # this is text
213
+ #-----
214
+ EOS
215
+
216
+ expected = <<-EOS
217
+ # this is text
218
+ EOS
219
+
220
+ @parser.remove_private_comments(comment)
221
+
222
+ assert_equal expected, comment
223
+ end
224
+
159
225
  def test_remove_private_comments_rule
160
226
  util_parser ''
161
227
 
@@ -193,6 +259,45 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
193
259
  assert_equal expected, comment
194
260
  end
195
261
 
262
+ def test_remove_private_comments_toggle_encoding
263
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
264
+
265
+ util_parser ''
266
+
267
+ comment = <<-EOS
268
+ # This is text
269
+ #--
270
+ # this is private
271
+ #++
272
+ # This is text again.
273
+ EOS
274
+
275
+ comment.force_encoding Encoding::IBM437
276
+
277
+ @parser.remove_private_comments comment
278
+
279
+ assert_equal Encoding::IBM437, comment.encoding
280
+ end
281
+
282
+ def test_remove_private_comments_toggle_encoding_ruby_bug?
283
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
284
+
285
+ util_parser ''
286
+
287
+ comment = <<-EOS
288
+ #--
289
+ # this is private
290
+ #++
291
+ # This is text again.
292
+ EOS
293
+
294
+ comment.force_encoding Encoding::IBM437
295
+
296
+ @parser.remove_private_comments comment
297
+
298
+ assert_equal Encoding::IBM437, comment.encoding
299
+ end
300
+
196
301
  def test_look_for_directives_in_commented
197
302
  util_parser ""
198
303
 
@@ -310,6 +415,8 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
310
415
  assert_equal klass, alas.parent
311
416
  assert_equal 'comment', alas.comment
312
417
  assert_equal @top_level, alas.file
418
+ assert_equal 0, alas.offset
419
+ assert_equal 1, alas.line
313
420
  end
314
421
 
315
422
  def test_parse_alias_singleton
@@ -361,6 +468,8 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
361
468
  assert_equal 'foo', foo.name
362
469
  assert_equal 'my attr', foo.comment
363
470
  assert_equal @top_level, foo.file
471
+ assert_equal 0, foo.offset
472
+ assert_equal 1, foo.line
364
473
  end
365
474
 
366
475
  def test_parse_attr_accessor
@@ -382,6 +491,8 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
382
491
  assert_equal 'RW', foo.rw
383
492
  assert_equal 'my attr', foo.comment
384
493
  assert_equal @top_level, foo.file
494
+ assert_equal 0, foo.offset
495
+ assert_equal 1, foo.line
385
496
 
386
497
  bar = klass.attributes.last
387
498
  assert_equal 'bar', bar.name
@@ -540,6 +651,9 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
540
651
  foo = @top_level.classes.first
541
652
  assert_equal 'Foo', foo.full_name
542
653
  assert_equal 'my method', foo.comment
654
+ assert_equal [@top_level], foo.in_files
655
+ assert_equal 0, foo.offset
656
+ assert_equal 1, foo.line
543
657
  end
544
658
 
545
659
  def test_parse_class_ghost_method
@@ -705,6 +819,10 @@ end
705
819
  assert_equal %w[A], RDoc::TopLevel.classes.map { |c| c.full_name }
706
820
  assert_equal %w[A::B A::d], RDoc::TopLevel.modules.map { |c| c.full_name }
707
821
 
822
+ b = RDoc::TopLevel.modules.first
823
+ assert_equal 10, b.offset
824
+ assert_equal 2, b.line
825
+
708
826
  # make sure method/alias was not added to enclosing class/module
709
827
  a = RDoc::TopLevel.all_classes_hash['A']
710
828
  assert_empty a.method_list
@@ -843,6 +961,8 @@ EOF
843
961
  assert_equal 'RW', foo.rw
844
962
  assert_equal 'my attr', foo.comment
845
963
  assert_equal @top_level, foo.file
964
+ assert_equal 0, foo.offset
965
+ assert_equal 1, foo.line
846
966
 
847
967
  assert_equal nil, foo.viewer
848
968
  assert_equal true, foo.document_children
@@ -872,6 +992,8 @@ EOF
872
992
  assert_equal 'foo', foo.name
873
993
  assert_equal 'my method', foo.comment
874
994
  assert_equal @top_level, foo.file
995
+ assert_equal 0, foo.offset
996
+ assert_equal 1, foo.line
875
997
 
876
998
  assert_equal [], foo.aliases
877
999
  assert_equal nil, foo.block_params
@@ -899,6 +1021,25 @@ EOF
899
1021
  assert_equal stream, foo.token_stream
900
1022
  end
901
1023
 
1024
+ def test_parse_constant
1025
+ util_top_level
1026
+
1027
+ klass = @top_level.add_class RDoc::NormalClass, 'Foo'
1028
+
1029
+ util_parser "A = v"
1030
+
1031
+ tk = @parser.get_tk
1032
+
1033
+ @parser.parse_constant klass, tk, ''
1034
+
1035
+ foo = klass.constants.first
1036
+
1037
+ assert_equal 'A', foo.name
1038
+ assert_equal @top_level, foo.file
1039
+ assert_equal 0, foo.offset
1040
+ assert_equal 1, foo.line
1041
+ end
1042
+
902
1043
  def test_parse_constant_attrasgn
903
1044
  util_top_level
904
1045
 
@@ -959,6 +1100,8 @@ EOF
959
1100
  assert_equal 'foo', foo.name
960
1101
  assert_equal 'my method', foo.comment
961
1102
  assert_equal @top_level, foo.file
1103
+ assert_equal 0, foo.offset
1104
+ assert_equal 1, foo.line
962
1105
 
963
1106
  assert_equal [], foo.aliases
964
1107
  assert_equal nil, foo.block_params
@@ -1118,6 +1261,8 @@ end
1118
1261
  assert_equal 'foo', foo.name
1119
1262
  assert_equal 'my method', foo.comment
1120
1263
  assert_equal @top_level, foo.file
1264
+ assert_equal 0, foo.offset
1265
+ assert_equal 1, foo.line
1121
1266
 
1122
1267
  assert_equal [], foo.aliases
1123
1268
  assert_equal nil, foo.block_params
@@ -1399,6 +1544,28 @@ end
1399
1544
  assert_equal 'my method', bar.comment
1400
1545
  end
1401
1546
 
1547
+ def test_parse_statements_encoding
1548
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
1549
+ @options.encoding = Encoding::CP852
1550
+
1551
+ content = <<-EOF
1552
+ class Foo
1553
+ ##
1554
+ # this is my method
1555
+ add_my_method :foo
1556
+ end
1557
+ EOF
1558
+
1559
+ util_parser content
1560
+
1561
+ @parser.parse_statements @top_level
1562
+
1563
+ foo = @top_level.classes.first.method_list.first
1564
+ assert_equal 'foo', foo.name
1565
+ assert_equal 'this is my method', foo.comment
1566
+ assert_equal Encoding::CP852, foo.comment.encoding
1567
+ end
1568
+
1402
1569
  def test_parse_statements_identifier_meta_method
1403
1570
  content = <<-EOF
1404
1571
  class Foo
@@ -1410,7 +1577,7 @@ end
1410
1577
 
1411
1578
  util_parser content
1412
1579
 
1413
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1580
+ @parser.parse_statements @top_level
1414
1581
 
1415
1582
  foo = @top_level.classes.first.method_list.first
1416
1583
  assert_equal 'foo', foo.name
@@ -1426,7 +1593,7 @@ end
1426
1593
 
1427
1594
  util_parser content
1428
1595
 
1429
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1596
+ @parser.parse_statements @top_level
1430
1597
 
1431
1598
  foo = @top_level.classes.first.method_list[0]
1432
1599
  assert_equal 'foo', foo.name
@@ -1459,7 +1626,7 @@ EOF
1459
1626
 
1460
1627
  util_parser content
1461
1628
 
1462
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1629
+ @parser.parse_statements @top_level
1463
1630
 
1464
1631
  foo = @top_level.classes.first.method_list[0]
1465
1632
  assert_equal 'foo', foo.name
@@ -1525,7 +1692,7 @@ EOF
1525
1692
 
1526
1693
  util_parser content
1527
1694
 
1528
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1695
+ @parser.parse_statements @top_level
1529
1696
 
1530
1697
  constants = @top_level.classes.first.constants
1531
1698
 
@@ -1572,7 +1739,7 @@ EOF
1572
1739
 
1573
1740
  util_parser content
1574
1741
 
1575
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1742
+ @parser.parse_statements @top_level
1576
1743
 
1577
1744
  foo = @top_level.classes.first.attributes.first
1578
1745
  assert_equal 'foo', foo.name
@@ -1584,7 +1751,7 @@ EOF
1584
1751
 
1585
1752
  util_parser content
1586
1753
 
1587
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1754
+ @parser.parse_statements @top_level
1588
1755
 
1589
1756
  foo = @top_level.classes.first.attributes.first
1590
1757
  assert_equal 'foo', foo.name
@@ -1596,7 +1763,7 @@ EOF
1596
1763
 
1597
1764
  util_parser content
1598
1765
 
1599
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1766
+ @parser.parse_statements @top_level
1600
1767
 
1601
1768
  foo = @top_level.classes.first
1602
1769
  assert_equal 'Foo', foo.name
@@ -1608,7 +1775,7 @@ EOF
1608
1775
 
1609
1776
  util_parser content
1610
1777
 
1611
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1778
+ @parser.parse_statements @top_level
1612
1779
 
1613
1780
  foo, s_foo = @top_level.modules.first.method_list
1614
1781
  assert_equal 'foo', foo.name, 'instance method name'
@@ -1625,7 +1792,7 @@ EOF
1625
1792
 
1626
1793
  util_parser content
1627
1794
 
1628
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1795
+ @parser.parse_statements @top_level
1629
1796
 
1630
1797
  foo = @top_level.classes.first.method_list.first
1631
1798
  assert_equal 'foo', foo.name
@@ -1637,7 +1804,7 @@ EOF
1637
1804
 
1638
1805
  util_parser content
1639
1806
 
1640
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1807
+ @parser.parse_statements @top_level
1641
1808
 
1642
1809
  assert_equal 1, @top_level.requires.length
1643
1810
  end
@@ -1655,7 +1822,7 @@ class A
1655
1822
  end
1656
1823
  RUBY
1657
1824
 
1658
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
1825
+ @parser.parse_statements @top_level
1659
1826
 
1660
1827
  c_a = @top_level.classes.first
1661
1828
  assert_equal 'A', c_a.full_name
@@ -1847,7 +2014,7 @@ class C
1847
2014
  end
1848
2015
  EOS
1849
2016
 
1850
- @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
2017
+ @parser.parse_statements @top_level
1851
2018
 
1852
2019
  foo = @top_level.modules.first.modules.first
1853
2020
  assert_equal 'Foo', foo.name
@@ -134,6 +134,31 @@ The comments associated with
134
134
  assert_equal expected, strip_hashes(text)
135
135
  end
136
136
 
137
+ def test_strip_hashes_encoding
138
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
139
+
140
+ text = <<-TEXT
141
+ ##
142
+ # we don't worry too much.
143
+ #
144
+ # The comments associated with
145
+ TEXT
146
+
147
+ text.force_encoding Encoding::CP852
148
+
149
+ expected = <<-EXPECTED
150
+
151
+ we don't worry too much.
152
+
153
+ The comments associated with
154
+ EXPECTED
155
+
156
+ stripped = strip_hashes text
157
+
158
+ assert_equal expected, stripped
159
+ assert_equal Encoding::CP852, stripped.encoding
160
+ end
161
+
137
162
  def test_strip_newlines
138
163
  assert_equal ' ', strip_newlines("\n \n")
139
164
 
@@ -178,6 +203,30 @@ The comments associated with
178
203
  assert_equal expected, strip_stars(text)
179
204
  end
180
205
 
206
+ def test_strip_stars_encoding
207
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
208
+
209
+ text = <<-TEXT
210
+ /*
211
+ * * we don't worry too much.
212
+ *
213
+ * The comments associated with
214
+ */
215
+ TEXT
216
+
217
+ text.force_encoding Encoding::CP852
218
+
219
+ expected = <<-EXPECTED
220
+
221
+ * we don't worry too much.
222
+
223
+ The comments associated with
224
+ EXPECTED
225
+
226
+ assert_equal expected, strip_stars(text)
227
+ assert_equal Encoding::CP852, text.encoding
228
+ end
229
+
181
230
  def test_to_html_apostrophe
182
231
  assert_equal '‘a', to_html("'a")
183
232
  assert_equal 'a’', to_html("a'")
@@ -28,7 +28,7 @@ class TestRDocTopLevel < XrefTestCase
28
28
  end
29
29
 
30
30
  def test_class_complete
31
- @c2.add_module_alias @c2_c3, 'A1'
31
+ @c2.add_module_alias @c2_c3, 'A1', @top_level
32
32
 
33
33
  RDoc::TopLevel.complete :public
34
34
 
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
4
+ hash: 13
5
+ prerelease:
6
6
  segments:
7
7
  - 3
8
- - 4
9
- version: "3.4"
8
+ - 5
9
+ version: "3.5"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Eric Hodel
@@ -38,29 +38,13 @@ cert_chain:
38
38
  x52qPcexcYZR7w==
39
39
  -----END CERTIFICATE-----
40
40
 
41
- date: 2011-01-06 00:00:00 -08:00
41
+ date: 2011-01-29 00:00:00 -08:00
42
42
  default_executable:
43
43
  dependencies:
44
- - !ruby/object:Gem::Dependency
45
- name: rubyforge
46
- prerelease: false
47
- requirement: &id001 !ruby/object:Gem::Requirement
48
- none: false
49
- requirements:
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- hash: 7
53
- segments:
54
- - 2
55
- - 0
56
- - 4
57
- version: 2.0.4
58
- type: :development
59
- version_requirements: *id001
60
44
  - !ruby/object:Gem::Dependency
61
45
  name: minitest
62
46
  prerelease: false
63
- requirement: &id002 !ruby/object:Gem::Requirement
47
+ requirement: &id001 !ruby/object:Gem::Requirement
64
48
  none: false
65
49
  requirements:
66
50
  - - ">="
@@ -72,11 +56,11 @@ dependencies:
72
56
  - 2
73
57
  version: 2.0.2
74
58
  type: :development
75
- version_requirements: *id002
59
+ version_requirements: *id001
76
60
  - !ruby/object:Gem::Dependency
77
61
  name: minitest
78
62
  prerelease: false
79
- requirement: &id003 !ruby/object:Gem::Requirement
63
+ requirement: &id002 !ruby/object:Gem::Requirement
80
64
  none: false
81
65
  requirements:
82
66
  - - ~>
@@ -86,11 +70,11 @@ dependencies:
86
70
  - 2
87
71
  version: "2"
88
72
  type: :development
89
- version_requirements: *id003
73
+ version_requirements: *id002
90
74
  - !ruby/object:Gem::Dependency
91
75
  name: isolate
92
76
  prerelease: false
93
- requirement: &id004 !ruby/object:Gem::Requirement
77
+ requirement: &id003 !ruby/object:Gem::Requirement
94
78
  none: false
95
79
  requirements:
96
80
  - - ~>
@@ -100,11 +84,11 @@ dependencies:
100
84
  - 3
101
85
  version: "3"
102
86
  type: :development
103
- version_requirements: *id004
87
+ version_requirements: *id003
104
88
  - !ruby/object:Gem::Dependency
105
89
  name: ZenTest
106
90
  prerelease: false
107
- requirement: &id005 !ruby/object:Gem::Requirement
91
+ requirement: &id004 !ruby/object:Gem::Requirement
108
92
  none: false
109
93
  requirements:
110
94
  - - ~>
@@ -114,23 +98,23 @@ dependencies:
114
98
  - 4
115
99
  version: "4"
116
100
  type: :development
117
- version_requirements: *id005
101
+ version_requirements: *id004
118
102
  - !ruby/object:Gem::Dependency
119
103
  name: hoe
120
104
  prerelease: false
121
- requirement: &id006 !ruby/object:Gem::Requirement
105
+ requirement: &id005 !ruby/object:Gem::Requirement
122
106
  none: false
123
107
  requirements:
124
108
  - - ">="
125
109
  - !ruby/object:Gem::Version
126
- hash: 19
110
+ hash: 47
127
111
  segments:
128
112
  - 2
129
- - 7
113
+ - 8
130
114
  - 0
131
- version: 2.7.0
115
+ version: 2.8.0
132
116
  type: :development
133
- version_requirements: *id006
117
+ version_requirements: *id005
134
118
  description: |-
135
119
  RDoc produces HTML and command-line documentation for Ruby projects. RDoc
136
120
  includes the +rdoc+ and +ri+ tools for generating and displaying online
@@ -319,6 +303,7 @@ files:
319
303
  - test/test_rdoc_top_level.rb
320
304
  - test/xref_data.rb
321
305
  - test/xref_test_case.rb
306
+ - .gemtest
322
307
  has_rdoc: true
323
308
  homepage: http://rdoc.rubyforge.org
324
309
  licenses: []
@@ -368,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
353
  requirements: []
369
354
 
370
355
  rubyforge_project: rdoc
371
- rubygems_version: 1.3.7
356
+ rubygems_version: 1.4.2
372
357
  signing_key:
373
358
  specification_version: 3
374
359
  summary: RDoc produces HTML and command-line documentation for Ruby projects