r324917 - Add a unit test for Driver::getDefaultModuleCachePath().
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 12 09:59:54 PST 2018
Author: adrian
Date: Mon Feb 12 09:59:54 2018
New Revision: 324917
URL: http://llvm.org/viewvc/llvm-project?rev=324917&view=rev
Log:
Add a unit test for Driver::getDefaultModuleCachePath().
Added:
cfe/trunk/unittests/Driver/ModuleCacheTest.cpp
Modified:
cfe/trunk/unittests/Driver/CMakeLists.txt
Modified: cfe/trunk/unittests/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/CMakeLists.txt?rev=324917&r1=324916&r2=324917&view=diff
==============================================================================
--- cfe/trunk/unittests/Driver/CMakeLists.txt (original)
+++ cfe/trunk/unittests/Driver/CMakeLists.txt Mon Feb 12 09:59:54 2018
@@ -7,6 +7,7 @@ set(LLVM_LINK_COMPONENTS
add_clang_unittest(ClangDriverTests
DistroTest.cpp
ToolChainTest.cpp
+ ModuleCacheTest.cpp
MultilibTest.cpp
)
Added: cfe/trunk/unittests/Driver/ModuleCacheTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/ModuleCacheTest.cpp?rev=324917&view=auto
==============================================================================
--- cfe/trunk/unittests/Driver/ModuleCacheTest.cpp (added)
+++ cfe/trunk/unittests/Driver/ModuleCacheTest.cpp Mon Feb 12 09:59:54 2018
@@ -0,0 +1,28 @@
+//===- unittests/Driver/ModuleCacheTest.cpp -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Unit tests for the LLDB module cache API.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Driver/Driver.h"
+#include "gtest/gtest.h"
+using namespace clang;
+using namespace clang::driver;
+
+namespace {
+
+TEST(ModuleCacheTest, GetTargetAndMode) {
+ SmallString<128> Buf;
+ Driver::getDefaultModuleCachePath(Buf);
+ StringRef Path = Buf;
+ EXPECT_TRUE(Path.find("org.llvm.clang") != Path.npos);
+ EXPECT_TRUE(Path.endswith("ModuleCache"));
+}
+} // end anonymous namespace.
More information about the cfe-commits
mailing list