mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Drop fs alias in favour of std::filesystem
Since we dropped fs::symlink_exists, we no longer have a need for the fs namespace. Having less abstractions makes it easier to lookup the functions in reference documentations.
This commit is contained in:
parent
5b59be914d
commit
979d5a7cae
20 changed files with 129 additions and 160 deletions
|
@ -163,8 +163,8 @@ TEST(machines, getMachinesWithIncorrectFormat) {
|
|||
}
|
||||
|
||||
TEST(machines, getMachinesWithCorrectFileReference) {
|
||||
auto path = fs::weakly_canonical(getUnitTestData() / "machines/valid");
|
||||
ASSERT_TRUE(fs::exists(path));
|
||||
auto path = std::filesystem::weakly_canonical(getUnitTestData() / "machines/valid");
|
||||
ASSERT_TRUE(std::filesystem::exists(path));
|
||||
|
||||
auto actual = Machine::parseConfig({}, "@" + path.string());
|
||||
ASSERT_THAT(actual, SizeIs(3));
|
||||
|
@ -174,22 +174,22 @@ TEST(machines, getMachinesWithCorrectFileReference) {
|
|||
}
|
||||
|
||||
TEST(machines, getMachinesWithCorrectFileReferenceToEmptyFile) {
|
||||
fs::path path = "/dev/null";
|
||||
ASSERT_TRUE(fs::exists(path));
|
||||
std::filesystem::path path = "/dev/null";
|
||||
ASSERT_TRUE(std::filesystem::exists(path));
|
||||
|
||||
auto actual = Machine::parseConfig({}, "@" + path.string());
|
||||
ASSERT_THAT(actual, SizeIs(0));
|
||||
}
|
||||
|
||||
TEST(machines, getMachinesWithIncorrectFileReference) {
|
||||
auto path = fs::weakly_canonical("/not/a/file");
|
||||
ASSERT_TRUE(!fs::exists(path));
|
||||
auto path = std::filesystem::weakly_canonical("/not/a/file");
|
||||
ASSERT_TRUE(!std::filesystem::exists(path));
|
||||
auto actual = Machine::parseConfig({}, "@" + path.string());
|
||||
ASSERT_THAT(actual, SizeIs(0));
|
||||
}
|
||||
|
||||
TEST(machines, getMachinesWithCorrectFileReferenceToIncorrectFile) {
|
||||
EXPECT_THROW(
|
||||
Machine::parseConfig({}, "@" + fs::weakly_canonical(getUnitTestData() / "machines" / "bad_format").string()),
|
||||
Machine::parseConfig({}, "@" + std::filesystem::weakly_canonical(getUnitTestData() / "machines" / "bad_format").string()),
|
||||
FormatError);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue