xref: /llvm-project/lldb/unittests/Host/FileSystemTest.cpp (revision 1408bf7231c22bce70fea5470a865955ee40399b)
1 //===-- FileSystemTest.cpp --------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "gtest/gtest.h"
11 
12 #include "lldb/Host/FileSystem.h"
13 
14 extern const char *TestMainArgv0;
15 
16 using namespace lldb_private;
17 
18 TEST(FileSystemTest, FileAndDirectoryComponents) {
19   using namespace std::chrono;
20 
21   const bool resolve = true;
22 #ifdef _WIN32
23   FileSpec fs1("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT", !resolve);
24 #else
25   FileSpec fs1("/file/that/does/not/exist.txt", !resolve);
26 #endif
27   FileSpec fs2(TestMainArgv0, resolve);
28 
29   EXPECT_EQ(system_clock::time_point(), FileSystem::GetModificationTime(fs1));
30   EXPECT_LT(system_clock::time_point() + hours(24 * 365 * 20),
31             FileSystem::GetModificationTime(fs2));
32 }
33