Skip to content

Commit 5c469cd

Browse files
committed
Fix test on Windows
1 parent 32238aa commit 5c469cd

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

clang/unittests/Tooling/ToolingTest.cpp

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,13 @@ TEST(ClangToolTest, ProgressReportMultipleFiles) {
11131113
Tool.run(newFrontendActionFactory<SyntaxOnlyAction>().get());
11141114
std::string Output = testing::internal::GetCapturedStderr();
11151115

1116-
std::string Expected = "[1/2] Processing file " + File1 + ".\n" +
1117-
"[2/2] Processing file " + File2 + ".\n";
1116+
SmallString<32> NativeFile1(File1);
1117+
llvm::sys::path::native(NativeFile1);
1118+
SmallString<32> NativeFile2(File2);
1119+
llvm::sys::path::native(NativeFile2);
1120+
std::string Expected = "[1/2] Processing file " + std::string(NativeFile1) +
1121+
".\n" + "[2/2] Processing file " +
1122+
std::string(NativeFile2) + ".\n";
11181123
EXPECT_EQ(Output, Expected);
11191124
}
11201125

@@ -1157,8 +1162,11 @@ TEST(ClangToolTest, ProgressReportMultipleCommands) {
11571162
Tool.run(newFrontendActionFactory<SyntaxOnlyAction>().get());
11581163
std::string Output = testing::internal::GetCapturedStderr();
11591164

1160-
std::string Expected = "[1/1] (1/2) Processing file " + File + ".\n" +
1161-
"[1/1] (2/2) Processing file " + File + ".\n";
1165+
SmallString<32> NativeFile(File);
1166+
llvm::sys::path::native(NativeFile);
1167+
std::string Expected =
1168+
"[1/1] (1/2) Processing file " + std::string(NativeFile) + ".\n" +
1169+
"[1/1] (2/2) Processing file " + std::string(NativeFile) + ".\n";
11621170
EXPECT_EQ(Output, Expected);
11631171
}
11641172

@@ -1215,10 +1223,17 @@ TEST(ClangToolTest, ProgressReportMixed) {
12151223
Tool.run(newFrontendActionFactory<SyntaxOnlyAction>().get());
12161224
std::string Output = testing::internal::GetCapturedStderr();
12171225

1218-
std::string Expected = "[1/3] Processing file " + File1 + ".\n" +
1219-
"[2/3] (1/2) Processing file " + File2 + ".\n" +
1220-
"[2/3] (2/2) Processing file " + File2 + ".\n" +
1221-
"[3/3] Processing file " + File3 + ".\n";
1226+
SmallString<32> NativeFile1(File1);
1227+
llvm::sys::path::native(NativeFile1);
1228+
SmallString<32> NativeFile2(File2);
1229+
llvm::sys::path::native(NativeFile2);
1230+
SmallString<32> NativeFile3(File3);
1231+
llvm::sys::path::native(NativeFile3);
1232+
std::string Expected =
1233+
"[1/3] Processing file " + std::string(NativeFile1) + ".\n" +
1234+
"[2/3] (1/2) Processing file " + std::string(NativeFile2) + ".\n" +
1235+
"[2/3] (2/2) Processing file " + std::string(NativeFile2) + ".\n" +
1236+
"[3/3] Processing file " + std::string(NativeFile3) + ".\n";
12221237
EXPECT_EQ(Output, Expected);
12231238
}
12241239

0 commit comments

Comments
 (0)