aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests/torture_misc.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2011-01-01 19:23:38 +0100
committerAndreas Schneider <asn@cynapses.org>2011-01-01 20:53:55 +0100
commite795dae8f270b5f4f916383b60257d19f9235a3e (patch)
tree6156c982a14b07778e9a216a4c48b716a4993a54 /tests/unittests/torture_misc.c
parent459fa3734f8e904eb93a6d71a44d6df6850fb149 (diff)
downloadlibssh-e795dae8f270b5f4f916383b60257d19f9235a3e.tar.gz
libssh-e795dae8f270b5f4f916383b60257d19f9235a3e.tar.xz
libssh-e795dae8f270b5f4f916383b60257d19f9235a3e.zip
tests: Added a windows test for torture_path_expand_tilde.
Diffstat (limited to 'tests/unittests/torture_misc.c')
-rw-r--r--tests/unittests/torture_misc.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c
index 70f4b5ac..e7562334 100644
--- a/tests/unittests/torture_misc.c
+++ b/tests/unittests/torture_misc.c
@@ -86,7 +86,26 @@ static void torture_ntohll(void **state) {
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 *d;
@@ -110,6 +129,8 @@ static void torture_path_expand_tilde(void **state) {
free(d);
}
+#endif /* _WIN32 */
+
static void torture_path_expand_escape(void **state) {
ssh_session session = *state;
const char *s = "%d/%h/by/%r";
@@ -141,7 +162,11 @@ int torture_run_tests(void) {
unit_test(torture_basename),
unit_test(torture_dirname),
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_known_hosts, setup, teardown),
};