diff options
Diffstat (limited to 'tests-clar')
| -rw-r--r-- | tests-clar/config/configlevel.c | 13 | ||||
| -rw-r--r-- | tests-clar/index/inmemory.c | 22 | ||||
| -rw-r--r-- | tests-clar/index/tests.c | 13 | ||||
| -rw-r--r-- | tests-clar/resources/config/config11 | 2 | ||||
| -rw-r--r-- | tests-clar/stash/save.c | 6 |
5 files changed, 53 insertions, 3 deletions
diff --git a/tests-clar/config/configlevel.c b/tests-clar/config/configlevel.c index d947856fa..69aede6d3 100644 --- a/tests-clar/config/configlevel.c +++ b/tests-clar/config/configlevel.c @@ -57,3 +57,16 @@ void test_config_configlevel__can_read_from_a_single_level_focused_file_after_pa git_config_free(single_level_cfg); } + +void test_config_configlevel__fetching_a_level_from_an_empty_compound_config_returns_ENOTFOUND(void) +{ + git_config *cfg; + git_config *local_cfg; + const char *s; + + cl_git_pass(git_config_new(&cfg)); + + cl_assert_equal_i(GIT_ENOTFOUND, git_config_open_level(&local_cfg, cfg, GIT_CONFIG_LEVEL_LOCAL)); + + git_config_free(cfg); +} diff --git a/tests-clar/index/inmemory.c b/tests-clar/index/inmemory.c new file mode 100644 index 000000000..c997b965f --- /dev/null +++ b/tests-clar/index/inmemory.c @@ -0,0 +1,22 @@ +#include "clar_libgit2.h" + +void test_index_inmemory__can_create_an_inmemory_index(void) +{ + git_index *index; + + cl_git_pass(git_index_new(&index)); + cl_assert_equal_i(0, git_index_entrycount(index)); + + git_index_free(index); +} + +void test_index_inmemory__cannot_add_from_workdir_to_an_inmemory_index(void) +{ + git_index *index; + + cl_git_pass(git_index_new(&index)); + + cl_assert_equal_i(GIT_ERROR, git_index_add_from_workdir(index, "test.txt")); + + git_index_free(index); +} diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c index cf971e1dd..d3f6f2582 100644 --- a/tests-clar/index/tests.c +++ b/tests-clar/index/tests.c @@ -248,3 +248,16 @@ void test_index_tests__add(void) git_repository_free(repo); } +void test_index_tests__add_from_workdir_to_a_bare_repository_returns_EBAREPO(void) +{ + git_repository *bare_repo; + git_index *index; + + cl_git_pass(git_repository_open(&bare_repo, cl_fixture("testrepo.git"))); + cl_git_pass(git_repository_index(&index, bare_repo)); + + cl_assert_equal_i(GIT_EBAREREPO, git_index_add_from_workdir(index, "test.txt")); + + git_index_free(index); + git_repository_free(bare_repo); +} diff --git a/tests-clar/resources/config/config11 b/tests-clar/resources/config/config11 index 880c94589..7331862a5 100644 --- a/tests-clar/resources/config/config11 +++ b/tests-clar/resources/config/config11 @@ -1,3 +1,5 @@ [remote "fancy"] url = git://github.com/libgit2/libgit2 url = git://git.example.com/libgit2 + + diff --git a/tests-clar/stash/save.c b/tests-clar/stash/save.c index 01acf672c..7524cdeb6 100644 --- a/tests-clar/stash/save.c +++ b/tests-clar/stash/save.c @@ -246,8 +246,8 @@ void test_stash_save__cannot_stash_when_there_are_no_local_change(void) * 'what' and 'who' are being committed. * 'when' remain untracked. */ - git_index_add_from_workdir(index, "what"); - git_index_add_from_workdir(index, "who"); + cl_git_pass(git_index_add_from_workdir(index, "what")); + cl_git_pass(git_index_add_from_workdir(index, "who")); cl_git_pass(git_index_write(index)); commit_staged_files(&commit_oid, index, signature); git_index_free(index); @@ -356,7 +356,7 @@ void test_stash_save__can_stage_normal_then_stage_untracked(void) void test_stash_save__including_untracked_without_any_untracked_file_creates_an_empty_tree(void) { - p_unlink("stash/when"); + cl_git_pass(p_unlink("stash/when")); assert_status("what", GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED); assert_status("how", GIT_STATUS_INDEX_MODIFIED); |
