diff options
author | Ben Straub <bs@github.com> | 2013-11-15 02:05:52 +0400 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-11-15 02:05:52 +0400 |
commit | 1782038144ef3413831801bb9c2f3038a84ac6f4 (patch) | |
tree | f074cc30890a20f5418c10fae1815ca516588a27 /tests/config/config_helpers.c | |
parent | 7b947bf5cc59eefa83c28eb5f5fd8434207ebb8b (diff) |
Rename tests-clar to tests
Diffstat (limited to 'tests/config/config_helpers.c')
-rw-r--r-- | tests/config/config_helpers.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/config/config_helpers.c b/tests/config/config_helpers.c new file mode 100644 index 000000000..53bd945a0 --- /dev/null +++ b/tests/config/config_helpers.c @@ -0,0 +1,37 @@ +#include "clar_libgit2.h" +#include "config_helpers.h" +#include "repository.h" + +void assert_config_entry_existence( + git_repository *repo, + const char *name, + bool is_supposed_to_exist) +{ + git_config *config; + const char *out; + int result; + + cl_git_pass(git_repository_config__weakptr(&config, repo)); + + result = git_config_get_string(&out, config, name); + + if (is_supposed_to_exist) + cl_git_pass(result); + else + cl_assert_equal_i(GIT_ENOTFOUND, result); +} + +void assert_config_entry_value( + git_repository *repo, + const char *name, + const char *expected_value) +{ + git_config *config; + const char *out; + + cl_git_pass(git_repository_config__weakptr(&config, repo)); + + cl_git_pass(git_config_get_string(&out, config, name)); + + cl_assert_equal_s(expected_value, out); +} |