mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
tests: Added a windows test for torture_path_expand_tilde.
This commit is contained in:
@@ -86,7 +86,26 @@ static void torture_ntohll(void **state) {
|
|||||||
assert_true(value == check);
|
assert_true(value == check);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void torture_path_expand_tilde(void **state) {
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
static void torture_path_expand_tilde_win(void **state) {
|
||||||
|
char *d;
|
||||||
|
|
||||||
|
(void) state;
|
||||||
|
|
||||||
|
d = ssh_path_expand_tilde("~\\.ssh");
|
||||||
|
assert_false(d == NULL);
|
||||||
|
print_message("Expanded path: %s\n", d);
|
||||||
|
free(d);
|
||||||
|
|
||||||
|
d = ssh_path_expand_tilde("/guru/meditation");
|
||||||
|
assert_string_equal(d, "/guru/meditation");
|
||||||
|
free(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* _WIN32 */
|
||||||
|
|
||||||
|
static void torture_path_expand_tilde_unix(void **state) {
|
||||||
char h[256];
|
char h[256];
|
||||||
char *d;
|
char *d;
|
||||||
|
|
||||||
@@ -110,6 +129,8 @@ static void torture_path_expand_tilde(void **state) {
|
|||||||
free(d);
|
free(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
static void torture_path_expand_escape(void **state) {
|
static void torture_path_expand_escape(void **state) {
|
||||||
ssh_session session = *state;
|
ssh_session session = *state;
|
||||||
const char *s = "%d/%h/by/%r";
|
const char *s = "%d/%h/by/%r";
|
||||||
@@ -141,7 +162,11 @@ int torture_run_tests(void) {
|
|||||||
unit_test(torture_basename),
|
unit_test(torture_basename),
|
||||||
unit_test(torture_dirname),
|
unit_test(torture_dirname),
|
||||||
unit_test(torture_ntohll),
|
unit_test(torture_ntohll),
|
||||||
unit_test(torture_path_expand_tilde),
|
#ifdef _WIN32
|
||||||
|
unit_test(torture_path_expand_tilde_win),
|
||||||
|
#else
|
||||||
|
unit_test(torture_path_expand_tilde_unix),
|
||||||
|
#endif
|
||||||
unit_test_setup_teardown(torture_path_expand_escape, setup, teardown),
|
unit_test_setup_teardown(torture_path_expand_escape, setup, teardown),
|
||||||
unit_test_setup_teardown(torture_path_expand_known_hosts, setup, teardown),
|
unit_test_setup_teardown(torture_path_expand_known_hosts, setup, teardown),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user