Skip to content

Commit 360629a

Browse files
tiennoucarlosmn
authored andcommitted
Fix grouping bug with namespc_name-style functions
Previously, function akin to `git_clone` would get part of their input file path appended, yielding `git2_clone` as the group.
1 parent db0f893 commit 360629a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/docurium.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ def group_functions!(data)
374374
k = key
375375
end
376376
group, rest = k.split('_', 2)
377-
next if group.empty?
378-
if !rest
379-
group = value[:file].gsub('.h', '').gsub('/', '_')
377+
if group.empty?
378+
puts "empty group for function #{key}"
379+
next
380380
end
381381
data[:functions][key][:group] = group
382382
func[group] ||= []

test/docurium_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ def test_can_get_the_full_description_from_multi_liners
175175
end
176176

177177
def test_can_group_functions
178-
assert_equal 15, @data[:groups].size
178+
groups = %w(blob commit index lasterror object odb oid reference repository revwalk signature strerror tag tree treebuilder work)
179+
assert_equal groups, @data[:groups].map {|g| g[0]}
179180
group, funcs = @data[:groups].first
180181
assert_equal 'blob', group
181182
assert_equal 6, funcs.size

0 commit comments

Comments
 (0)