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