summaryrefslogtreecommitdiff
path: root/tests-clar/index/tests.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2013-05-31 18:12:49 -0500
committerRussell Belfer <rb@github.com>2013-06-17 10:03:49 -0700
commit1540b19990fa5c566d607785c7b3651756e706ff (patch)
tree667cb2267578b95d60c6018f6ee85581147acf70 /tests-clar/index/tests.c
parent351888cf3dc3c3525faccb010adcf5c130ac5b16 (diff)
downloadlibgit2-1540b19990fa5c566d607785c7b3651756e706ff.tar.gz
some simple case-sensitive index tests
Diffstat (limited to 'tests-clar/index/tests.c')
-rw-r--r--tests-clar/index/tests.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c
index 88e374e6e..53d45a84e 100644
--- a/tests-clar/index/tests.c
+++ b/tests-clar/index/tests.c
@@ -416,3 +416,35 @@ void test_index_tests__remove_directory(void)
git_repository_free(repo);
cl_fixture_cleanup("index_test");
}
+
+void test_index_tests__preserves_case(void)
+{
+ git_repository *repo;
+ git_index *index;
+ const git_index_entry *entry;
+
+ cl_set_cleanup(&cleanup_myrepo, NULL);
+
+ cl_git_pass(git_repository_init(&repo, "./myrepo", 0));
+ cl_git_pass(git_repository_index(&index, repo));
+
+ cl_git_rewritefile("myrepo/test.txt", "hey there\n");
+ cl_git_pass(git_index_add_bypath(index, "test.txt"));
+
+ cl_git_pass(p_rename("myrepo/test.txt", "myrepo/TEST.txt"));
+ cl_git_rewritefile("myrepo/TEST.txt", "hello again\n");
+ cl_git_pass(git_index_add_bypath(index, "TEST.txt"));
+
+ cl_assert(git_index_entrycount(index) == 1);
+
+ /* Test access by path instead of index */
+ cl_assert((entry = git_index_get_bypath(index, "test.txt", 0)) != NULL);
+ cl_assert((entry = git_index_get_bypath(index, "TEST.txt", 0)) != NULL);
+
+ /* The path should *not* have changed without an explicit remove */
+ cl_assert(git__strcmp(entry->path, "test.txt") == 0);
+
+ git_index_free(index);
+ git_repository_free(repo);
+}
+