summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-11-17 05:22:39 -0800
committernulltoken <emeric.fermas@gmail.com>2012-11-17 05:41:22 -0800
commit0e95e70a55b2c7af64370c0b886d4d00f8bea839 (patch)
tree771c4a9132ef3e91a2a327493fa7dd80c98517e0
parentaa8a76eff9494e109c2c72c72ad687faaf05db3d (diff)
downloadlibgit2-0e95e70a55b2c7af64370c0b886d4d00f8bea839.tar.gz
env: ensure git_futils_find_xxx() returns ENOTFOUND
-rw-r--r--tests-clar/core/env.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests-clar/core/env.c b/tests-clar/core/env.c
index 288222d29..d849f76ed 100644
--- a/tests-clar/core/env.c
+++ b/tests-clar/core/env.c
@@ -84,13 +84,15 @@ void test_core_env__0(void)
cl_git_mkfile(path.ptr, "find me");
git_buf_rtruncate_at_char(&path, '/');
- cl_git_fail(git_futils_find_global_file(&found, testfile));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_global_file(&found, testfile));
setenv_and_check("HOME", path.ptr);
cl_git_pass(git_futils_find_global_file(&found, testfile));
cl_setenv("HOME", env_save[0]);
- cl_git_fail(git_futils_find_global_file(&found, testfile));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_global_file(&found, testfile));
#ifdef GIT_WIN32
setenv_and_check("HOMEDRIVE", NULL);
@@ -106,7 +108,8 @@ void test_core_env__0(void)
if (root >= 0) {
setenv_and_check("USERPROFILE", NULL);
- cl_git_fail(git_futils_find_global_file(&found, testfile));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_global_file(&found, testfile));
old = path.ptr[root];
path.ptr[root] = '\0';
@@ -128,7 +131,8 @@ void test_core_env__1(void)
{
git_buf path = GIT_BUF_INIT;
- cl_must_fail(git_futils_find_global_file(&path, "nonexistentfile"));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_global_file(&path, "nonexistentfile"));
cl_git_pass(cl_setenv("HOME", "doesnotexist"));
#ifdef GIT_WIN32
@@ -136,7 +140,8 @@ void test_core_env__1(void)
cl_git_pass(cl_setenv("USERPROFILE", "doesnotexist"));
#endif
- cl_must_fail(git_futils_find_global_file(&path, "nonexistentfile"));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_global_file(&path, "nonexistentfile"));
cl_git_pass(cl_setenv("HOME", NULL));
#ifdef GIT_WIN32
@@ -144,13 +149,16 @@ void test_core_env__1(void)
cl_git_pass(cl_setenv("USERPROFILE", NULL));
#endif
- cl_must_fail(git_futils_find_global_file(&path, "nonexistentfile"));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_global_file(&path, "nonexistentfile"));
- cl_must_fail(git_futils_find_system_file(&path, "nonexistentfile"));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_system_file(&path, "nonexistentfile"));
#ifdef GIT_WIN32
cl_git_pass(cl_setenv("PROGRAMFILES", NULL));
- cl_must_fail(git_futils_find_system_file(&path, "nonexistentfile"));
+ cl_assert_equal_i(
+ GIT_ENOTFOUND, git_futils_find_system_file(&path, "nonexistentfile"));
#endif
git_buf_free(&path);