lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master bfa1255 27/33: Enable some tests that were co


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bfa1255 27/33: Enable some tests that were conditionally suppressed
Date: Mon, 3 May 2021 08:15:55 -0400 (EDT)

branch: master
commit bfa1255c94824a082a1221a798c15b0ae63434f1
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Enable some tests that were conditionally suppressed
    
    Whether these tests should be retained is a separate question.
    But performing one on msw only, when it performs in exactly the
    same way on posix, was inconsistent.
---
 path_utility.cpp      |  3 +++
 path_utility_test.cpp | 21 ++++++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/path_utility.cpp b/path_utility.cpp
index 9232cbb..f67d19a 100644
--- a/path_utility.cpp
+++ b/path_utility.cpp
@@ -347,6 +347,9 @@ void validate_path
 {
     fs::path const path{a_path};
 
+    // BOOST !! This is where well-formedness with respect to OS rules
+    // ought to be tested.
+
     if(path.empty())
         {
         alarum() << context << " must not be empty." << LMI_FLUSH;
diff --git a/path_utility_test.cpp b/path_utility_test.cpp
index 52a3b3b..d600460 100644
--- a/path_utility_test.cpp
+++ b/path_utility_test.cpp
@@ -406,28 +406,27 @@ void test_path_validation()
     validate_filepath("path_utility_test_file", context);
     validate_filepath("./path_utility_test_file", context);
 
-    // Not well formed.
-#if 0
-    // Neither posix nor msw allows NUL in paths. However, the boost
-    // filesystem library doesn't throw an explicit exception here;
-    // instead, it aborts with:
-    //   "Assertion `src.size() == std::strlen( src.c_str() )' failed."
-    // Perhaps std::filesystem will trap this and throw an exception.
+    // BOOST !! With boost::filesystem, a path was not well-formed
+    // if it contained forbidden characters. With std::filesystem,
+    // semantic validity is not considered, and any syntactically
+    // valid path is well formed. Therefore, shouldn't the lmi
+    // 'validate_*' functions test semantic validity? If not, the
+    // next two tests are senseless.
+
+    // Neither posix nor msw allows NUL in paths.
     std::string nulls = {'\0', '\0'};
     LMI_TEST_THROW
         (validate_filepath(nulls, context)
         ,std::runtime_error
-        ,lmi_test::what_regex("invalid name \"<|>\" in path")
+        ,"Unit test file '' not found."
         );
-#endif // 0
 
-#if defined LMI_MSW
+    // Posix doesn't forbid these characters, though msw does.
     LMI_TEST_THROW
         (validate_filepath("<|>", context)
         ,std::runtime_error
         ,"Unit test file '<|>' not found."
         );
-#endif // defined LMI_MSW
 
     // Not empty.
     LMI_TEST_THROW



reply via email to

[Prev in Thread] Current Thread [Next in Thread]