Quellcode durchsuchen

Improve directory creation exception

Patrick-Christopher Mattulat vor 1 Jahr
Ursprung
Commit
fb571b08c9
2 geänderte Dateien mit 5 neuen und 1 gelöschten Zeilen
  1. 1 1
      source/ls-std/io/File.cpp
  2. 4 0
      test/cases/io/FileTest.cpp

+ 1 - 1
source/ls-std/io/File.cpp

@@ -208,7 +208,7 @@ void File::makeDirectory()
 {
   if (!File::_makeDirectory(this->absoluteFilePath))
   {
-    throw FileOperationException{"operation: create directory"};
+    throw FileOperationException{R"lit(directory ")lit" + this->absoluteFilePath + R"lit(" could not be created!)lit"};
   }
 }
 

+ 4 - 0
test/cases/io/FileTest.cpp

@@ -322,6 +322,10 @@ namespace
           }
           catch (const FileOperationException &_exception)
           {
+            string expected = _exception.getName() + R"lit( thrown - directory ")lit" + TestHelper::getResourcesFolderLocation() + R"lit(list-test" could not be created!)lit";
+            string actual = _exception.what();
+
+            ASSERT_STREQ(expected.c_str(), actual.c_str());
             throw;
           }
         },