Skip to content

Commit 853e7b3

Browse files
authored
Merge pull request #49 from tiennou/fix/parsing-tests
Additional parsing tests
2 parents a92cbf8 + e784a0c commit 853e7b3

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/docurium_test.rb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ def teardown
2828
FileUtils.remove_entry(@dir)
2929
end
3030

31+
def test_can_parse
32+
refute_nil @data
33+
assert_equal [:files, :functions, :callbacks, :globals, :types, :prefix, :groups], @data.keys
34+
files = %w(blob.h callback.h cherrypick.h commit.h common.h errors.h index.h object.h odb.h odb_backend.h oid.h refs.h repository.h revwalk.h signature.h tag.h tree.h types.h)
35+
assert_equal files, @data[:files].map {|d| d[:file] }
36+
end
37+
3138
def test_can_parse_headers
3239
keys = @data.keys.map { |k| k.to_s }.sort
3340
assert_equal ['callbacks', 'files', 'functions', 'globals', 'groups', 'prefix', 'types'], keys
@@ -164,6 +171,40 @@ def test_can_parse_function_cast_args
164171
assert_equal expect_comment.split("\n"), func[:comments].split("\n")
165172
end
166173

174+
def test_can_handle_bulleted_lists
175+
type = @data[:types].find {|name, data| name == 'git_repository_init_options' }
176+
refute_nil type
177+
expect_comment = <<-EOF
178+
<p>This contains extra options for <code>git_repository_init_ext</code> that enable
179+
additional initialization features. The fields are:</p>
180+
181+
<ul>
182+
<li>flags - Combination of GIT_REPOSITORY_INIT flags above.</li>
183+
<li>mode - Set to one of the standard GIT_REPOSITORY_INIT_SHARED_...
184+
constants above, or to a custom value that you would like.</li>
185+
<li>workdir_path - The path to the working dir or NULL for default (i.e.
186+
repo_path parent on non-bare repos). IF THIS IS RELATIVE PATH,
187+
IT WILL BE EVALUATED RELATIVE TO THE REPO_PATH. If this is not
188+
the &quot;natural&quot; working directory, a .git gitlink file will be
189+
created here linking to the repo_path.</li>
190+
<li>description - If set, this will be used to initialize the &quot;description&quot;
191+
file in the repository, instead of using the template content.</li>
192+
<li>template_path - When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set,
193+
this contains the path to use for the template directory. If
194+
this is NULL, the config or default directory options will be
195+
used instead.</li>
196+
<li>initial_head - The name of the head to point HEAD at. If NULL, then
197+
this will be treated as &quot;master&quot; and the HEAD ref will be set
198+
to &quot;refs/heads/master&quot;. If this begins with &quot;refs/&quot; it will be
199+
used verbatim; otherwise &quot;refs/heads/&quot; will be prefixed.</li>
200+
<li>origin_url - If this is non-NULL, then after the rest of the
201+
repository initialization is completed, an &quot;origin&quot; remote
202+
will be added pointing to this URL.</li>
203+
</ul>
204+
EOF
205+
assert_equal expect_comment, type[1][:comments]
206+
end
207+
167208
def test_can_get_the_full_description_from_multi_liners
168209
func = @data[:functions]['git_commit_create_o']
169210
desc = "<p>Create a new commit in the repository using <code>git_object</code>\n instances as parameters.</p>\n"

0 commit comments

Comments
 (0)