From f2862523d8f2d676fdd99c82c813eabc8a9f15f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 19 May 2021 21:42:40 +0200 Subject: [PATCH] [DEBUG] Try fs::equivalent() instead of == --- test/TemporaryDirectory.cpp | 4 ++-- test/TemporaryDirectoryTest.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/TemporaryDirectory.cpp b/test/TemporaryDirectory.cpp index e13be7b02eaa..e84cfa873eb3 100644 --- a/test/TemporaryDirectory.cpp +++ b/test/TemporaryDirectory.cpp @@ -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; diff --git a/test/TemporaryDirectoryTest.cpp b/test/TemporaryDirectoryTest.cpp index dee1f77a937f..7444862b1d98 100644 --- a/test/TemporaryDirectoryTest.cpp +++ b/test/TemporaryDirectoryTest.cpp @@ -74,8 +74,8 @@ 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()); @@ -83,9 +83,9 @@ BOOST_AUTO_TEST_CASE(TemporaryWorkingDirectory_should_change_and_restore_working 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); }