diff options
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index ecf4db2d4c..c63f97d7f6 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -588,6 +588,21 @@ test_util_expand_filename(void) /* Ideally we'd test ~anotheruser, but that's shady to test (we'd have to somehow inject/fake the get_user_homedir call) */ + /* $HOME ending in a trailing slash */ + setenv("HOME", "/home/itv/", 1); + + str = expand_filename("~"); + test_streq("/home/itv/", str); + tor_free(str); + + str = expand_filename("~/"); + test_streq("/home/itv/", str); + tor_free(str); + + str = expand_filename("~/foo"); + test_streq("/home/itv/foo", str); + tor_free(str); + /* Try with empty $HOME */ setenv("HOME", "", 1); |