summaryrefslogtreecommitdiff
path: root/tests-clar
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-03-22 09:17:34 -0700
committerRussell Belfer <arrbee@arrbee.com>2012-03-22 09:17:34 -0700
commit95340398a1821bd19da1bfe459ba1f375ed89404 (patch)
tree92274fa06af3b9f239f4c530b9e66fe6e86dfe99 /tests-clar
parenta48ea31d69a76d6b398d3a1e522a1c7363a9b92a (diff)
downloadlibgit2-95340398a1821bd19da1bfe459ba1f375ed89404.tar.gz
Adding new tests for new status command
This is a work in progress. This adds two new sets of tests, the issue_592 tests from @nulltoken's pull request #601 and some new tests for submodules. The submodule tests still have issues where the status is not reported correctly. That needs to be fixed before merge.
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/status/worktree.c87
1 files changed, 85 insertions, 2 deletions
diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c
index f80975795..98bb2b819 100644
--- a/tests-clar/status/worktree.c
+++ b/tests-clar/status/worktree.c
@@ -2,7 +2,7 @@
#include "fileops.h"
#include "ignore.h"
#include "status_data.h"
-
+#include "posix.h"
/**
* Auxiliary methods
@@ -43,7 +43,6 @@ cb_status__count(const char *p, unsigned int s, void *payload)
return 0;
}
-
/**
* Initializer
*
@@ -133,3 +132,87 @@ void test_status_worktree__ignores(void)
);
cl_assert(ignored);
}
+
+static int cb_status__check_592(const char *p, unsigned int s, void *payload)
+{
+ GIT_UNUSED(payload);
+
+ if (s != GIT_STATUS_WT_DELETED || (payload != NULL && strcmp(p, (const char *)payload) != 0))
+ return -1;
+
+ return 0;
+}
+
+void test_status_worktree__issue_592(void)
+{
+ git_repository *repo;
+ git_buf path = GIT_BUF_INIT;
+
+ repo = cl_git_sandbox_init("issue_592");
+ cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "l.txt"));
+ cl_git_pass(p_unlink(git_buf_cstr(&path)));
+
+ cl_git_pass(git_status_foreach(repo, cb_status__check_592, "l.txt"));
+
+ git_buf_free(&path);
+}
+
+void test_status_worktree__issue_592_2(void)
+{
+ git_repository *repo;
+ git_buf path = GIT_BUF_INIT;
+
+ repo = cl_git_sandbox_init("issue_592");
+ cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c/a.txt"));
+ cl_git_pass(p_unlink(git_buf_cstr(&path)));
+
+ cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
+
+ git_buf_free(&path);
+}
+
+void test_status_worktree__issue_592_3(void)
+{
+ git_repository *repo;
+ git_buf path = GIT_BUF_INIT;
+
+ repo = cl_git_sandbox_init("issue_592");
+
+ cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c"));
+ cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), 1));
+
+ cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
+
+ git_buf_free(&path);
+}
+
+void test_status_worktree__issue_592_4(void)
+{
+ git_repository *repo;
+ git_buf path = GIT_BUF_INIT;
+
+ repo = cl_git_sandbox_init("issue_592");
+
+ cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t/b.txt"));
+ cl_git_pass(p_unlink(git_buf_cstr(&path)));
+
+ cl_git_pass(git_status_foreach(repo, cb_status__check_592, "t/b.txt"));
+
+ git_buf_free(&path);
+}
+
+void test_status_worktree__issue_592_5(void)
+{
+ git_repository *repo;
+ git_buf path = GIT_BUF_INIT;
+
+ repo = cl_git_sandbox_init("issue_592");
+
+ cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t"));
+ cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), 1));
+ cl_git_pass(p_mkdir(git_buf_cstr(&path), 0777));
+
+ cl_git_pass(git_status_foreach(repo, cb_status__check_592, NULL));
+
+ git_buf_free(&path);
+}