commit 8e88377905edd10df10da1fc39dfe247c2270663 Author: Esteban Manchado Velázquez emanchado@demiurgo.org Date: Mon Feb 20 22:52:15 2012 +0100
expand_filename tests for trailing slash in $HOME --- 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 ecf4db2..c63f97d 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);