Skip to content

Commit 8a730ff

Browse files
authored
Merge pull request #32 from libgit2/cmn/two-levels
Allow functions with just two namespace levels
2 parents db0f893 + 58d5bb1 commit 8a730ff

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def teardown
4040
def test_can_parse_headers
4141
keys = @data.keys.map { |k| k.to_s }.sort
4242
assert_equal ['callbacks', 'files', 'functions', 'globals', 'groups', 'prefix', 'types'], keys
43-
assert_equal 154, @data[:functions].size
43+
assert_equal 155, @data[:functions].size
4444
end
4545

4646
def test_can_extract_enum_from_define
@@ -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 cherrypick 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]}.sort
179180
group, funcs = @data[:groups].first
180181
assert_equal 'blob', group
181182
assert_equal 6, funcs.size

test/fixtures/git2/cherrypick.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef INCLUDE_git_blob_h__
2+
#define INCLUDE_git_blob_h__
3+
4+
#include "common.h"
5+
#include "types.h"
6+
7+
GIT_BEGIN_DECL
8+
9+
/**
10+
* Perform a cherry-pick
11+
*
12+
* @param input dummy input
13+
* @returns the usual
14+
*/
15+
GIT_EXTERN(int) git_cherrypick(char *input);
16+
17+
GIT_END_DECL

0 commit comments

Comments
 (0)