lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master bc805ad 28/33: Augment path-validation unit t


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bc805ad 28/33: Augment path-validation unit test
Date: Mon, 3 May 2021 08:15:55 -0400 (EDT)

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

    Augment path-validation unit test
---
 path_utility_test.cpp | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/path_utility_test.cpp b/path_utility_test.cpp
index d600460..dcf0be6 100644
--- a/path_utility_test.cpp
+++ b/path_utility_test.cpp
@@ -428,6 +428,34 @@ void test_path_validation()
         ,"Unit test file '<|>' not found."
         );
 
+    // Posix doesn't forbid filenames with more than two consecutive
+    // dots; msw-nt forbids them; and, worse, msw-95 allows them and
+    // defines them to mean the {grandparent, great grandparent, ...}
+    // of a directory.
+    //
+    // This conditional block of tests is pointless today, but if
+    // semantic validity in the OS context is to be enforced by lmi's
+    // 'validate_' functions, they will become valuable.
+#if defined LMI_POSIX
+    LMI_TEST_THROW
+        (validate_filepath("...", context)
+        ,std::runtime_error
+        ,"Unit test file '...' not found."
+        );
+#elif defined LMI_MSW
+    if(!running_under_wine())
+        {
+        // At least some versions of 'wine' don't throw here.
+        LMI_TEST_THROW
+            (validate_directory("...", context)
+            ,std::runtime_error
+            ,"Unit test file '...' not found."
+            );
+        }
+#else  // Unknown platform.
+    throw "Unrecognized platform."
+#endif // Unknown platform.
+
     // Not empty.
     LMI_TEST_THROW
         (validate_filepath("", context)



reply via email to

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