[clang-tools-extra] [include-cleaner][NFC] expose and test `normalizePath` helper (PR #189364)

Daniil Dudkin via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 12:14:15 PDT 2026


================
@@ -98,5 +99,18 @@ TEST(RecordedIncludesTest, MatchVerbatimMixedAbsoluteRelative) {
   EXPECT_THAT(Inc.match(Header("<bar.h>")), IsEmpty());
 }
 
+TEST(NormalizePathTest, RemovesDotSegments) {
+  EXPECT_EQ(normalizePath("foo/./bar/../baz").str(), "foo/baz");
+  EXPECT_EQ(normalizePath("foo/bar/").str(), "foo/bar");
+}
+
+TEST(NormalizePathTest, CanonicalizesSeparators) {
+  EXPECT_EQ(normalizePath("foo\\bar").str(), "foo/bar");
+}
+
+TEST(NormalizePathTest, PreservesRootPath) {
+  EXPECT_EQ(normalizePath("/").str(), "/");
+}
----------------
unterumarmung wrote:

Done

https://github.com/llvm/llvm-project/pull/189364


More information about the cfe-commits mailing list