Skip to content

Commit

Permalink
Add checks for parent paths in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Mar 24, 2024
1 parent d99eb4f commit fbef626
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/directory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ namespace fs = tmp::fs;
TEST(DirectoryTest, CreateDirectory) {
{
const auto tmpdir = tmp::directory(PREFIX);
const auto parent = tmpdir->parent_path();

ASSERT_TRUE(fs::exists(tmpdir));
ASSERT_TRUE(fs::equivalent(parent, fs::temp_directory_path() / PREFIX));
}
{
const auto tmpdir = tmp::directory();
const auto parent = tmpdir->parent_path();

ASSERT_TRUE(fs::exists(tmpdir));
ASSERT_TRUE(fs::equivalent(parent, fs::temp_directory_path()));
}
}

Expand Down
6 changes: 6 additions & 0 deletions tests/file_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ namespace fs = tmp::fs;
TEST(FileTest, CreateFile) {
{
const auto tmpfile = tmp::file(PREFIX);
const auto parent = tmpfile->parent_path();

ASSERT_TRUE(fs::exists(tmpfile));
ASSERT_TRUE(fs::equivalent(parent, fs::temp_directory_path() / PREFIX));
}
{
const auto tmpfile = tmp::file();
const auto parent = tmpfile->parent_path();

ASSERT_TRUE(fs::exists(tmpfile));
ASSERT_TRUE(fs::equivalent(parent, fs::temp_directory_path()));
}
}

Expand Down

0 comments on commit fbef626

Please sign in to comment.