Skip to content

Commit

Permalink
[DEBUG] Try fs::equivalent() instead of ==
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed May 19, 2021
1 parent bf431b0 commit f286252
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/TemporaryDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ TemporaryDirectory::~TemporaryDirectory()
{
// A few paranoid sanity checks just to be extra sure we're not deleting someone's homework.
assert(m_path.string().find(fs::temp_directory_path().string()) == 0);
assert(m_path != fs::temp_directory_path());
assert(m_path != m_path.root_path());
assert(!fs::equivalent(m_path, fs::temp_directory_path()));
assert(!fs::equivalent(m_path, m_path.root_path()));
assert(!m_path.empty());

boost::system::error_code errorCode;
Expand Down
8 changes: 4 additions & 4 deletions test/TemporaryDirectoryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ BOOST_AUTO_TEST_CASE(TemporaryWorkingDirectory_should_change_and_restore_working
{
{
TemporaryDirectory tempDir("temporary-directory-test-");
assert(fs::current_path() == originalWorkingDirectory);
assert(tempDir.path() != originalWorkingDirectory);
assert(fs::equivalent(fs::current_path(), originalWorkingDirectory));
assert(!fs::equivalent(tempDir.path(), originalWorkingDirectory));

TemporaryWorkingDirectory tempWorkDir(tempDir.path());

// TMP:
cout << "Actual current path: " << fs::current_path() << endl;
cout << "Expected current path: " << tempDir.path() << endl;

BOOST_TEST(fs::current_path() == tempDir.path());
BOOST_TEST(fs::equivalent(fs::current_path(), tempDir.path()));
}
BOOST_TEST(fs::current_path() == originalWorkingDirectory);
BOOST_TEST(fs::equivalent(fs::current_path(), originalWorkingDirectory));

fs::current_path(originalWorkingDirectory);
}
Expand Down

0 comments on commit f286252

Please sign in to comment.