aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEsteban Manchado Velázquez <emanchado@demiurgo.org>2012-02-20 22:52:15 +0100
committerNick Mathewson <nickm@torproject.org>2012-03-08 21:16:46 -0500
commit8e88377905edd10df10da1fc39dfe247c2270663 (patch)
treea138f92a7b923ff7f9c8740c71eb9221064d8e34 /src
parent043e154cddea9247c5e8432a7445a57ea5ab08c8 (diff)
downloadtor-8e88377905edd10df10da1fc39dfe247c2270663.tar
tor-8e88377905edd10df10da1fc39dfe247c2270663.tar.gz
expand_filename tests for trailing slash in $HOME
Diffstat (limited to 'src')
-rw-r--r--src/test/test_util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index ecf4db2d4..c63f97d7f 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);