diff --git a/lib/docurium.rb b/lib/docurium.rb index f8ad66160..2f4187c70 100644 --- a/lib/docurium.rb +++ b/lib/docurium.rb @@ -374,9 +374,9 @@ def group_functions!(data) k = key end group, rest = k.split('_', 2) - next if group.empty? - if !rest - group = value[:file].gsub('.h', '').gsub('/', '_') + if group.empty? + puts "empty group for function #{key}" + next end data[:functions][key][:group] = group func[group] ||= [] diff --git a/test/docurium_test.rb b/test/docurium_test.rb index 05dd317dc..7851f8913 100644 --- a/test/docurium_test.rb +++ b/test/docurium_test.rb @@ -40,7 +40,7 @@ def teardown def test_can_parse_headers keys = @data.keys.map { |k| k.to_s }.sort assert_equal ['callbacks', 'files', 'functions', 'globals', 'groups', 'prefix', 'types'], keys - assert_equal 154, @data[:functions].size + assert_equal 155, @data[:functions].size end def test_can_extract_enum_from_define @@ -175,7 +175,8 @@ def test_can_get_the_full_description_from_multi_liners end def test_can_group_functions - assert_equal 15, @data[:groups].size + groups = %w(blob cherrypick commit index lasterror object odb oid reference repository revwalk signature strerror tag tree treebuilder work) + assert_equal groups, @data[:groups].map {|g| g[0]}.sort group, funcs = @data[:groups].first assert_equal 'blob', group assert_equal 6, funcs.size diff --git a/test/fixtures/git2/cherrypick.h b/test/fixtures/git2/cherrypick.h new file mode 100644 index 000000000..0793acc2f --- /dev/null +++ b/test/fixtures/git2/cherrypick.h @@ -0,0 +1,17 @@ +#ifndef INCLUDE_git_blob_h__ +#define INCLUDE_git_blob_h__ + +#include "common.h" +#include "types.h" + +GIT_BEGIN_DECL + +/** + * Perform a cherry-pick + * + * @param input dummy input + * @returns the usual + */ +GIT_EXTERN(int) git_cherrypick(char *input); + +GIT_END_DECL