summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorJoel Rosdahl <joel.rosdahl@maxar.com>2022-12-21 13:16:12 +0100
committerJoel Rosdahl <joel@rosdahl.net>2022-12-23 10:56:43 +0100
commita68cae9021a445550afdcd1bcce3cb3352c3c8f9 (patch)
tree5d58d1e1a3ba1a7d624934f5d5a634c59e809fe5 /unittest
parent7cf41457e07ae0c2f8a05f96ed7894c9ac707dde (diff)
downloadccache-a68cae9021a445550afdcd1bcce3cb3352c3c8f9.tar.gz
fix: Fix matching of base directory for MSVC
The base directory will now match case-insensitively with absolute paths in preprocessed output, or from /showIncludes in the depend mode case, when compiling with MSVC.
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_argprocessing.cpp4
-rw-r--r--unittest/test_util_path.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/unittest/test_argprocessing.cpp b/unittest/test_argprocessing.cpp
index 1a59f6a2..062d6622 100644
--- a/unittest/test_argprocessing.cpp
+++ b/unittest/test_argprocessing.cpp
@@ -59,7 +59,9 @@ get_posix_path(const std::string& path)
std::string posix;
// /-escape volume.
- if (path[0] >= 'A' && path[0] <= 'Z' && path[1] == ':') {
+ if (path[1] == ':'
+ && ((path[0] >= 'A' && path[0] <= 'Z')
+ || (path[0] >= 'a' && path[0] <= 'z'))) {
posix = "/" + path;
} else {
posix = path;
diff --git a/unittest/test_util_path.cpp b/unittest/test_util_path.cpp
index 43defcad..8bb703df 100644
--- a/unittest/test_util_path.cpp
+++ b/unittest/test_util_path.cpp
@@ -131,6 +131,8 @@ TEST_CASE("util::path_starts_with")
CHECK(util::path_starts_with("C:/foo/bar", "C:\\\\foo"));
CHECK(util::path_starts_with("C:\\foo\\bar", "C:/foo"));
CHECK(util::path_starts_with("C:\\\\foo\\\\bar", "C:/foo"));
+ CHECK(util::path_starts_with("C:/FOO/BAR", "c:\\foo"));
+ CHECK(util::path_starts_with("c:/foo/bar", "C:\\FOO"));
CHECK(!util::path_starts_with("C:\\foo\\bar", "/foo/baz"));
CHECK(!util::path_starts_with("C:\\foo\\bar", "C:/foo/baz"));
CHECK(!util::path_starts_with("C:\\beh\\foo", "/foo"));