aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/Path.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-01-31 23:46:06 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-01-31 23:46:06 +0000
commitf7d4101156fd3f5c034edde12adb1eabde07cef5 (patch)
tree60588c0ce040d7da898098d0a53f502487b63bda /llvm/unittests/Support/Path.cpp
parentdfbed59cc26a0918d5bf1dade19f6c95b64581e0 (diff)
downloadllvm-f7d4101156fd3f5c034edde12adb1eabde07cef5.zip
llvm-f7d4101156fd3f5c034edde12adb1eabde07cef5.tar.gz
llvm-f7d4101156fd3f5c034edde12adb1eabde07cef5.tar.bz2
Introduce llvm::sys::path::home_directory.
This will be used by the line editor library to derive a default path to the history file. Differential Revision: http://llvm-reviews.chandlerc.com/D2199 llvm-svn: 200594
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r--llvm/unittests/Support/Path.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index f71c7c5..197e1c2 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -210,6 +210,19 @@ TEST(Support, AbsolutePathIteratorWin32) {
}
#endif // LLVM_ON_WIN32
+TEST(Support, HomeDirectory) {
+#ifdef LLVM_ON_UNIX
+ // This test only makes sense on Unix if $HOME is set.
+ if (::getenv("HOME")) {
+#endif
+ SmallString<128> HomeDir;
+ EXPECT_TRUE(path::home_directory(HomeDir));
+ EXPECT_FALSE(HomeDir.empty());
+#ifdef LLVM_ON_UNIX
+ }
+#endif
+}
+
class FileSystemTest : public testing::Test {
protected:
/// Unique temporary directory in which all created filesystem entities must