-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_xlings.cpp
More file actions
37 lines (25 loc) · 1.04 KB
/
test_xlings.cpp
File metadata and controls
37 lines (25 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <gtest/gtest.h>
import std;
import mcpp.xlings;
namespace {
std::filesystem::path make_tempdir(std::string_view name) {
auto base = std::filesystem::temp_directory_path()
/ std::format("{}-{}", name, std::chrono::steady_clock::now().time_since_epoch().count());
std::filesystem::create_directories(base);
return base;
}
} // namespace
TEST(XlingsIndexFreshness, RequiresDefaultMcpplibsIndex) {
auto home = make_tempdir("mcpp-xlings-index-freshness");
std::filesystem::create_directories(home / "data" / "xim-pkgindex" / "pkgs");
mcpp::xlings::Env env{.home = home};
EXPECT_FALSE(mcpp::xlings::is_index_fresh(env, 3600));
std::filesystem::remove_all(home);
}
TEST(XlingsIndexFreshness, AcceptsFreshDefaultMcpplibsIndex) {
auto home = make_tempdir("mcpp-xlings-index-freshness");
std::filesystem::create_directories(home / "data" / "mcpplibs" / "pkgs");
mcpp::xlings::Env env{.home = home};
EXPECT_TRUE(mcpp::xlings::is_index_fresh(env, 3600));
std::filesystem::remove_all(home);
}