From d2beafa03e11c9a255bc19a79e12ee548f68bdd4 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Fri, 18 May 2018 23:00:37 -0700 Subject: [PATCH] Fix AppDataDirExists test on Travis CI --- test/cpp-utils/system/HomedirTest.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/cpp-utils/system/HomedirTest.cpp b/test/cpp-utils/system/HomedirTest.cpp index e3cff3c8..b08c1bfa 100644 --- a/test/cpp-utils/system/HomedirTest.cpp +++ b/test/cpp-utils/system/HomedirTest.cpp @@ -13,8 +13,13 @@ TEST(HomedirTest, HomedirExists) { EXPECT_TRUE(bf::exists(HomeDirectory::get())); } -TEST(HomedirTest, AppDataDirExists) { - EXPECT_TRUE(bf::exists(HomeDirectory::getXDGDataDir())); +TEST(HomedirTest, AppDataDirIsValid) { + auto dir = HomeDirectory::getXDGDataDir(); + EXPECT_FALSE(dir.empty()); + EXPECT_GE(dir.size(), 2u); // has at least two components + for(const auto& component : dir) { + EXPECT_TRUE(component.native() == "/" || bf::native(component.native())); + } } TEST(HomedirTest, FakeHomeDirectorySetsHomedirCorrectly) {