1 #include "clar_libgit2.h"
3 #include "git2/clone.h"
8 static git_buf path
= GIT_BUF_INIT
;
10 void test_win32_longpath__initialize(void)
13 const char *base
= clar_sandbox_path();
14 size_t base_len
= strlen(base
);
15 size_t remain
= MAX_PATH
- base_len
;
19 git_buf_puts(&path
, base
);
20 git_buf_putc(&path
, '/');
22 cl_assert(remain
< (MAX_PATH
- 5));
24 for (i
= 0; i
< (remain
- 5); i
++)
25 git_buf_putc(&path
, 'a');
29 void test_win32_longpath__cleanup(void)
35 void assert_name_too_long(void)
38 size_t expected_len
, actual_len
;
42 actual_len
= strlen(err
->message
);
44 expected_msg
= git_win32_get_error_message(ERROR_FILENAME_EXCED_RANGE
);
45 expected_len
= strlen(expected_msg
);
47 /* check the suffix */
48 cl_assert_equal_s(expected_msg
, err
->message
+ (actual_len
- expected_len
));
50 git__free(expected_msg
);
54 void test_win32_longpath__errmsg_on_checkout(void)
59 cl_git_fail(git_clone(&repo
, cl_fixture("testrepo.git"), path
.ptr
, NULL
));
60 assert_name_too_long();