11 #include "gmock/gmock.h" 12 #include "gtest/gtest.h" 18 TEST(FSTests, PreambleStatusCache) {
19 llvm::StringMap<std::string>
Files;
26 PreambleFileStatusCache StatCache(
testPath(
"main"));
27 auto ProduceFS = StatCache.getProducingFS(
FS);
28 EXPECT_TRUE(ProduceFS->openFileForRead(
"x"));
29 EXPECT_TRUE(ProduceFS->status(
"y"));
30 EXPECT_TRUE(ProduceFS->status(
"main"));
32 EXPECT_TRUE(StatCache.lookup(
testPath(
"x")).hasValue());
33 EXPECT_TRUE(StatCache.lookup(
testPath(
"y")).hasValue());
35 EXPECT_FALSE(StatCache.lookup(
testPath(
"main")).hasValue());
37 llvm::vfs::Status S(
"fake", llvm::sys::fs::UniqueID(123, 456),
38 std::chrono::system_clock::now(), 0, 0, 1024,
39 llvm::sys::fs::file_type::regular_file,
40 llvm::sys::fs::all_all);
41 StatCache.update(*
FS, S);
42 auto ConsumeFS = StatCache.getConsumingFS(
FS);
43 auto Cached = ConsumeFS->status(
testPath(
"fake"));
45 EXPECT_EQ(Cached->getName(),
testPath(
"fake"));
46 EXPECT_EQ(Cached->getUniqueID(), S.getUniqueID());
50 auto CachedDotDot = ConsumeFS->status(
testPath(
"temp/../fake"));
51 EXPECT_TRUE(CachedDotDot);
52 EXPECT_EQ(CachedDotDot->getName(),
testPath(
"temp/../fake"));
53 EXPECT_EQ(CachedDotDot->getUniqueID(), S.getUniqueID());
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > buildTestFS(llvm::StringMap< std::string > const &Files, llvm::StringMap< time_t > const &Timestamps)
TEST(BackgroundQueueTest, Priority)
std::string testPath(PathRef File)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::StringMap< std::string > Files