Skip to content

Commit a2a37ef

Browse files
authored
Merge pull request #119 from ksss/fixmissing
Fix when class namespace
2 parents 2e6dc91 + 63b8f35 commit a2a37ef

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/orthoses/missing_name.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def call
5151
end
5252
missings.uniq!
5353
missings.each do |missing|
54-
@store[missing].header = "module #{missing}"
54+
@store[missing]
5555
end
5656
end
5757

lib/orthoses/missing_name_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class C3
1717
extend M2
1818
end
1919
end
20+
class CC
21+
module MM
22+
end
23+
end
2024
}
2125
def test_missing_name(t)
2226
store = Orthoses::MissingName.new(
@@ -25,10 +29,15 @@ def test_missing_name(t)
2529
Orthoses::Utils.new_store.tap do |store|
2630
store["MissingNameTest::M1::M2"] << "CONST: 1"
2731
store["MissingNameTest::C1::C2"].header = "class MissingNameTest::C1::C2 < ::MissingNameTest::C1"
32+
store["MissingNameTest::CC::MM"]
2833
end
2934
}
3035
).call
3136

37+
store.each do |_, content|
38+
content.auto_header
39+
end
40+
3241
unless store.has_key?("MissingNameTest::M1::M2")
3342
t.error("MissingNameTest::M1::M2 not found in store")
3443
end
@@ -59,5 +68,11 @@ def test_missing_name(t)
5968
unless store.has_key?("MissingNameTest")
6069
t.error("MissingNameTest not found in store")
6170
end
71+
unless store["MissingNameTest::CC::MM"].header == "module MissingNameTest::CC::MM"
72+
t.error("MissingNameTest::CC::MM should be module")
73+
end
74+
unless store["MissingNameTest::CC"].header == "class MissingNameTest::CC"
75+
t.error("MissingNameTest::CC should be class")
76+
end
6277
end
6378
end

0 commit comments

Comments
 (0)