Author: Haojian Wu Date: 2023-01-19T10:48:54+01:00 New Revision: ccb67491f0dd55c5bd8ed5f71cb802422bfaa969
URL: https://github.com/llvm/llvm-project/commit/ccb67491f0dd55c5bd8ed5f71cb802422bfaa969 DIFF: https://github.com/llvm/llvm-project/commit/ccb67491f0dd55c5bd8ed5f71cb802422bfaa969.diff LOG: [clangd] Simplify some tests in IncludeCleanerTests, NFC They were pointed out in the review of https://reviews.llvm.org/D140875 Added: Modified: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp b/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp index 9449952b10e80..0e4163122d255 100644 --- a/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp +++ b/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp @@ -340,9 +340,8 @@ TEST(IncludeCleaner, StdlibUnused) { TU.AdditionalFiles["queue"] = "#include <bits>"; TU.ExtraArgs = {"-isystem", testRoot()}; auto AST = TU.build(); - - auto Unused = computeUnusedIncludes(AST); - EXPECT_THAT(Unused, ElementsAre(Pointee(writtenInclusion("<queue>")))); + EXPECT_THAT(computeUnusedIncludes(AST), + ElementsAre(Pointee(writtenInclusion("<queue>")))); } TEST(IncludeCleaner, GetUnusedHeaders) { @@ -374,11 +373,10 @@ TEST(IncludeCleaner, GetUnusedHeaders) { TU.ExtraArgs.push_back("-isystem" + testPath("system")); TU.Code = MainFile.str(); ParsedAST AST = TU.build(); - std::vector<std::string> UnusedIncludes; - for (const auto &Include : computeUnusedIncludes(AST)) - UnusedIncludes.push_back(Include->Written); - EXPECT_THAT(UnusedIncludes, - UnorderedElementsAre("\"unused.h\"", "\"dir/unused.h\"")); + EXPECT_THAT( + computeUnusedIncludes(AST), + UnorderedElementsAre(Pointee(writtenInclusion("\"unused.h\"")), + Pointee(writtenInclusion("\"dir/unused.h\"")))); } TEST(IncludeCleaner, VirtualBuffers) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits