Skip to content

Commit 768285e

Browse files
committed
Add test_each_section_only_display
1 parent 7d6c5f4 commit 768285e

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

test/test_rdoc_context.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,32 @@ def test_each_section
481481
assert_equal expected_attrs, attrs
482482
end
483483

484+
def test_each_section_only_display
485+
sects = []
486+
consts = []
487+
attrs = []
488+
489+
@c7.each_section do |section, constants, attributes|
490+
sects << section
491+
consts << constants
492+
attrs << attributes
493+
end
494+
495+
assert_equal [nil], sects.map { |section| section.title }
496+
497+
expected_consts = [
498+
@c7.constants.select(&:display?).sort
499+
]
500+
501+
assert_equal expected_consts, consts
502+
503+
expected_attrs = [
504+
@c7.attributes.select(&:display?).sort
505+
]
506+
507+
assert_equal expected_attrs, attrs
508+
end
509+
484510
def test_each_section_enumerator
485511
assert_kind_of Enumerator, @c1.each_section
486512
end

test/test_rdoc_store.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_add_file_relative
162162

163163
def test_all_classes_and_modules
164164
expected = %w[
165-
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6
165+
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7
166166
Child
167167
M1 M1::M2
168168
Parent
@@ -213,7 +213,7 @@ def test_class_path
213213

214214
def test_classes
215215
expected = %w[
216-
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6
216+
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7
217217
Child
218218
Parent
219219
]

test/xref_data.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ def prot5() end
8282
def prot6() end
8383
end
8484
85+
class C7
86+
attr_reader :attr_reader
87+
attr_reader :attr_reader_nodoc # :nodoc:
88+
attr_writer :attr_writer
89+
attr_writer :attr_writer_nodoc # :nodoc:
90+
attr_accessor :attr_accessor
91+
attr_accessor :attr_accessor_nodoc # :nodoc:
92+
93+
CONST = :const
94+
CONST_NODOC = :const_nodoc # :nodoc:
95+
end
96+
8597
module M1
8698
def m
8799
end

test/xref_test_case.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def generator.file_dir() nil end
5252
@c3_h1 = @xref_data.find_module_named 'C3::H1'
5353
@c3_h2 = @xref_data.find_module_named 'C3::H2'
5454
@c6 = @xref_data.find_module_named 'C6'
55+
@c7 = @xref_data.find_module_named 'C7'
5556

5657
@m1 = @xref_data.find_module_named 'M1'
5758
@m1_m = @m1.method_list.first

0 commit comments

Comments
 (0)