Skip to content

Commit 8d154e9

Browse files
tiennoucarlosmn
authored andcommitted
Don't test magic values
1 parent 060ad7b commit 8d154e9

File tree

1 file changed

+64
-3
lines changed

1 file changed

+64
-3
lines changed

test/docurium_test.rb

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,64 @@ def test_can_extract_structs_and_enums
6262

6363
def test_can_find_type_usage
6464
oid = @data[:types].assoc('git_oid')
65-
assert_equal 10, oid[1][:used][:returns].size
66-
assert_equal 39, oid[1][:used][:needs].size
65+
oid_returns = [
66+
"git_commit_id",
67+
"git_commit_parent_oid",
68+
"git_commit_tree_oid",
69+
"git_object_id",
70+
"git_odb_object_id",
71+
"git_oid_shorten_new",
72+
"git_reference_oid",
73+
"git_tag_id",
74+
"git_tag_target_oid",
75+
"git_tree_entry_id",
76+
"git_tree_id"
77+
]
78+
assert_equal oid_returns, oid[1][:used][:returns]
79+
oid_needs = [
80+
"git_blob_create_frombuffer",
81+
"git_blob_create_fromfile",
82+
"git_blob_lookup",
83+
"git_commit_create",
84+
"git_commit_create_o",
85+
"git_commit_create_ov",
86+
"git_commit_create_v",
87+
"git_commit_lookup",
88+
"git_object_lookup",
89+
"git_odb_exists",
90+
"git_odb_hash",
91+
"git_odb_open_rstream",
92+
"git_odb_read",
93+
"git_odb_read_header",
94+
"git_odb_write",
95+
"git_oid_allocfmt",
96+
"git_oid_cmp",
97+
"git_oid_cpy",
98+
"git_oid_fmt",
99+
"git_oid_mkraw",
100+
"git_oid_mkstr",
101+
"git_oid_pathfmt",
102+
"git_oid_shorten_add",
103+
"git_oid_shorten_free",
104+
"git_oid_to_string",
105+
"git_reference_create_oid",
106+
"git_reference_create_oid_f",
107+
"git_reference_set_oid",
108+
"git_revwalk_hide",
109+
"git_revwalk_next",
110+
"git_revwalk_push",
111+
"git_tag_create",
112+
"git_tag_create_f",
113+
"git_tag_create_fo",
114+
"git_tag_create_frombuffer",
115+
"git_tag_create_o",
116+
"git_tag_lookup",
117+
"git_tree_create_fromindex",
118+
"git_tree_lookup",
119+
"git_treebuilder_insert",
120+
"git_treebuilder_write"
121+
]
122+
assert_equal oid_needs, oid[1][:used][:needs]
67123
end
68124

69125
def test_can_parse_normal_functions
@@ -104,7 +160,12 @@ def test_can_parse_function_cast_args
104160
assert_equal 'callback', func[:args][2][:name]
105161
assert_equal 'int (*)(const char *, void *)', func[:args][2][:type]
106162
assert_equal 'Function which will be called for every listed ref', func[:args][2][:comment]
107-
assert_equal 8, func[:comments].split("\n").size
163+
expect_comment =<<-EOF
164+
<p>The listed references may be filtered by type, or using a bitwise OR of several types. Use the magic value <code>GIT_REF_LISTALL</code> to obtain all references, including packed ones.</p>
165+
166+
<p>The <code>callback</code> function will be called for each of the references in the repository, and will receive the name of the reference and the <code>payload</code> value passed to this method.</p>
167+
EOF
168+
assert_equal expect_comment.split("\n").map(&:strip), func[:comments].split("\n")
108169
end
109170

110171
def test_can_get_the_full_description_from_multi_liners

0 commit comments

Comments
 (0)