diff options
author | Andreas Schneider <mail@cynapses.org> | 2010-05-10 22:47:21 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2010-05-11 02:10:55 +0200 |
commit | c5c1698cde431a8e0142c3936862069f77c3e5a8 (patch) | |
tree | 14a5192b1c3bef5b6e54aeacab3f28ad912fd883 /tests/unittests | |
parent | 4df7daec82eeae4d492a34c0d8c37e186e65fd77 (diff) | |
download | libssh-c5c1698cde431a8e0142c3936862069f77c3e5a8.tar.gz libssh-c5c1698cde431a8e0142c3936862069f77c3e5a8.tar.xz libssh-c5c1698cde431a8e0142c3936862069f77c3e5a8.zip |
Added a torture test for ssh_path_expand_tilde().
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/torture_misc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c index 94b2c7c6..63c15371 100644 --- a/tests/unittests/torture_misc.c +++ b/tests/unittests/torture_misc.c @@ -68,6 +68,30 @@ START_TEST (torture_ntohll) } END_TEST +START_TEST (torture_path_expand_tilde) +{ + char h[256]; + char *d; + + snprintf(h, 256 - 1, "%s/.ssh", getenv("HOME")); + + d = ssh_path_expand_tilde("~/.ssh"); + ck_assert_str_eq(d, h); + free(d); + + d = ssh_path_expand_tilde("/guru/meditation"); + ck_assert_str_eq(d, "/guru/meditation"); + free(d); + + snprintf(h, 256 - 1, "~%s/.ssh", getenv("USER")); + d = ssh_path_expand_tilde(h); + + snprintf(h, 256 - 1, "%s/.ssh", getenv("HOME")); + ck_assert_str_eq(d, h); + free(d); +} +END_TEST + static Suite *torture_make_suite(void) { Suite *s = suite_create("libssh_misc"); @@ -75,6 +99,7 @@ static Suite *torture_make_suite(void) { torture_create_case(s, "torture_basename", torture_basename); torture_create_case(s, "torture_dirname", torture_dirname); torture_create_case(s, "torture_ntohll", torture_ntohll); + torture_create_case(s, "torture_path_expand_tilde", torture_path_expand_tilde); return s; } |