From: Esteban Manchado Velázquez Date: Mon, 20 Feb 2012 21:52:15 +0000 (+0100) Subject: expand_filename tests for trailing slash in $HOME X-Git-Tag: tor-0.2.3.13-alpha~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e88377905edd10df10da1fc39dfe247c2270663;p=thirdparty%2Ftor.git expand_filename tests for trailing slash in $HOME --- 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);