arpadboda commented on a change in pull request #709: MINIFICPP-1088 - clean up 
minifiexe and MINIFI_HOME logic
URL: https://github.com/apache/nifi-minifi-cpp/pull/709#discussion_r367357073
 
 

 ##########
 File path: libminifi/test/unit/FileUtilsTests.cpp
 ##########
 @@ -146,3 +148,33 @@ TEST_CASE("TestFileUtils::create_dir", "[TestCreateDir]") 
{
   REQUIRE(FileUtils::create_dir(test_dir_path) == 0);  // Dir already exists, 
success should be returned
   REQUIRE(FileUtils::delete_dir(test_dir_path) == 0);  // Delete should be 
successful as welll
 }
+
+TEST_CASE("TestFileUtils::getFullPath", "[TestGetFullPath]") {
+  TestController testController;
+
+  char format[] = "/tmp/gt.XXXXXX";
+  const std::string tempDir = 
utils::file::PathUtils::getFullPath(testController.createTempDirectory(format));
+
+  const std::string cwd = utils::Environment::getCurrentWorkingDirectory();
+
+  REQUIRE(utils::Environment::setCurrentWorkingDirectory(tempDir.c_str()));
+  utils::ScopeGuard cwdGuard([&cwd]() {
+    utils::Environment::setCurrentWorkingDirectory(cwd.c_str());
+  });
+
+  const std::string tempDir1 = utils::file::FileUtils::concat_path(tempDir, 
"test1");
+  const std::string tempDir2 = utils::file::FileUtils::concat_path(tempDir, 
"test2");
+  REQUIRE(0 == utils::file::FileUtils::create_dir(tempDir1));
+  REQUIRE(0 == utils::file::FileUtils::create_dir(tempDir2));
+
+  REQUIRE(tempDir1 == utils::file::PathUtils::getFullPath(tempDir1));
+  REQUIRE(tempDir1 == utils::file::PathUtils::getFullPath("test1"));
+  REQUIRE(tempDir1 == utils::file::PathUtils::getFullPath("./test1"));
+  REQUIRE(tempDir1 == utils::file::PathUtils::getFullPath("././test1"));
 
 Review comment:
   Is this expected to work on Win?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to