[clang] [clang][test] Fix test failures when LLVM_WINDOWS_PREFER_FORWARD_SLAS… (PR #193156)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 23:00:32 PDT 2026


================
@@ -840,10 +840,14 @@ TEST(ToolChainTest, ConfigInexistentInclude) {
     ASSERT_TRUE(C);
     ASSERT_TRUE(C->containsError());
     EXPECT_EQ(1U, DiagConsumer->Errors.size());
-    EXPECT_STRCASEEQ("cannot read configuration file '" USERCONFIG
-                     "': cannot not open file '" UNEXISTENT
-                     "': no such file or directory",
-                     DiagConsumer->Errors[0].c_str());
+    // Expected path style in diagnostics depends on
+    // LLVM_WINDOWS_PREFER_FORWARD_SLASH. Construct the expected string
+    // dynamically to match the native path style.
+    std::string ExpectedError =
+        "cannot read configuration file '" +
+        llvm::sys::path::native(USERCONFIG) + "': cannot not open file '" +
+        llvm::sys::path::native(UNEXISTENT) + "': no such file or directory";
+    EXPECT_EQ(ExpectedError, DiagConsumer->Errors[0]);
----------------
mstorsjo wrote:

You seem to need to keep `EXPECT_STRCASEEQ` here.

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


More information about the cfe-commits mailing list