summaryrefslogtreecommitdiff
path: root/tests-clar/core/path.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-03-16 15:16:52 +0100
committernulltoken <emeric.fermas@gmail.com>2012-03-16 15:16:52 +0100
commit7b93079b5b7c5f58de321bb9846e93b1717d3e4c (patch)
treea57958a3f68e326fe657aacd3e63c39ac725a9d9 /tests-clar/core/path.c
parente24fbba94862fdb602846771f2ae41ef15834d10 (diff)
downloadlibgit2-7b93079b5b7c5f58de321bb9846e93b1717d3e4c.tar.gz
Make git_path_root() cope with windows network paths
Fix libgit2/libgit2sharp#125
Diffstat (limited to 'tests-clar/core/path.c')
-rw-r--r--tests-clar/core/path.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests-clar/core/path.c b/tests-clar/core/path.c
index c07362f1..c1e3ef29 100644
--- a/tests-clar/core/path.c
+++ b/tests-clar/core/path.c
@@ -388,3 +388,18 @@ void test_core_path__11_walkup(void)
git_buf_free(&p);
}
+
+void test_core_path__12_offset_to_path_root(void)
+{
+ cl_assert(git_path_root("non/rooted/path") == -1);
+ cl_assert(git_path_root("/rooted/path") == 0);
+
+#ifdef GIT_WIN32
+ /* Windows specific tests */
+ cl_assert(git_path_root("C:non/rooted/path") == -1);
+ cl_assert(git_path_root("C:/rooted/path") == 2);
+ cl_assert(git_path_root("//computername/sharefolder/resource") == 14);
+ cl_assert(git_path_root("//computername/sharefolder") == 14);
+ cl_assert(git_path_root("//computername") == -1);
+#endif
+}