diff options
| author | Vicent Marti <tanoku@gmail.com> | 2012-10-16 19:34:29 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2012-10-16 19:37:21 +0200 |
| commit | 18217e7e8abaef5f5ae5582231c7d6fbc2741f74 (patch) | |
| tree | d2106836377ee53616c7ffb1d1fcb204313f9113 | |
| parent | a891841850d50d68842c88f57cd3f7c9cbdff38f (diff) | |
| download | libgit2-18217e7e8abaef5f5ae5582231c7d6fbc2741f74.tar.gz | |
test: Don't be so picky with failed lookups
Not found means not found, and the other way around.
| -rw-r--r-- | src/fileops.c | 6 | ||||
| -rw-r--r-- | tests-clar/core/env.c | 12 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/fileops.c b/src/fileops.c index 763537a46..6abab8836 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -418,14 +418,14 @@ int git_futils_find_global_file(git_buf *path, const char *filename) root.path[0] == L'%') /* i.e. no expansion happened */ { giterr_set(GITERR_OS, "Cannot locate the user's profile directory"); - return -1; + return GIT_ENOTFOUND; } } else { if (win32_expand_path(&root, L"%USERPROFILE%\\") < 0 || root.path[0] == L'%') /* i.e. no expansion happened */ { giterr_set(GITERR_OS, "Cannot locate the user's profile directory"); - return -1; + return GIT_ENOTFOUND; } } @@ -440,7 +440,7 @@ int git_futils_find_global_file(git_buf *path, const char *filename) if (home == NULL) { giterr_set(GITERR_OS, "Global file lookup failed. " "Cannot locate the user's home directory"); - return -1; + return GIT_ENOTFOUND; } if (git_buf_joinpath(path, home, filename) < 0) diff --git a/tests-clar/core/env.c b/tests-clar/core/env.c index a2a65be72..0e0ddf3b6 100644 --- a/tests-clar/core/env.c +++ b/tests-clar/core/env.c @@ -87,7 +87,7 @@ void test_core_env__1(void) { git_buf path = GIT_BUF_INIT; - cl_assert(git_futils_find_global_file(&path, "nonexistentfile") == GIT_ENOTFOUND); + cl_must_fail(git_futils_find_global_file(&path, "nonexistentfile")); #ifdef GIT_WIN32 cl_git_pass(cl_setenv("USERPROFILE", "doesnotexist")); @@ -95,7 +95,7 @@ void test_core_env__1(void) cl_git_pass(cl_setenv("HOME", "doesnotexist")); #endif - cl_assert(git_futils_find_global_file(&path, "nonexistentfile") == GIT_ENOTFOUND); + cl_must_fail(git_futils_find_global_file(&path, "nonexistentfile")); #ifdef GIT_WIN32 cl_git_pass(cl_setenv("USERPROFILE", NULL)); @@ -103,14 +103,12 @@ void test_core_env__1(void) cl_git_pass(cl_setenv("HOME", NULL)); #endif - cl_assert(git_futils_find_global_file(&path, "nonexistentfile") == -1); - - cl_assert(git_futils_find_system_file(&path, "nonexistentfile") == GIT_ENOTFOUND); + cl_must_fail(git_futils_find_global_file(&path, "nonexistentfile")); + cl_must_fail(git_futils_find_system_file(&path, "nonexistentfile")); #ifdef GIT_WIN32 cl_git_pass(cl_setenv("PROGRAMFILES", NULL)); - - cl_assert(git_futils_find_system_file(&path, "nonexistentfile") == -1); + cl_must_fail(git_futils_find_system_file(&path, "nonexistentfile")); #endif git_buf_free(&path); |
