Author: Kadir Cetinkaya Date: 2022-11-15T13:31:40+01:00 New Revision: eed1f337a1fbf8c1e7e53a6e1d0dfd4eb800aa08
URL: https://github.com/llvm/llvm-project/commit/eed1f337a1fbf8c1e7e53a6e1d0dfd4eb800aa08 DIFF: https://github.com/llvm/llvm-project/commit/eed1f337a1fbf8c1e7e53a6e1d0dfd4eb800aa08.diff LOG: [clang][Tooling] Sort filenames in test Added: Modified: clang/unittests/Tooling/CompilationDatabaseTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 89763f9f8d52..fb8c10df38e8 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -17,6 +17,7 @@ #include "llvm/Support/TargetSelect.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include <algorithm> namespace clang { namespace tooling { @@ -62,7 +63,9 @@ static std::vector<std::string> getAllFiles(StringRef JSONDatabase, ADD_FAILURE() << ErrorMessage; return std::vector<std::string>(); } - return Database->getAllFiles(); + auto Result = Database->getAllFiles(); + std::sort(Result.begin(), Result.end()); + return Result; } static std::vector<CompileCommand> @@ -90,10 +93,10 @@ TEST(JSONCompilationDatabase, GetAllFiles) { expected_files.push_back(std::string(PathStorage.str())); llvm::sys::path::native("//net/dir/file2", PathStorage); expected_files.push_back(std::string(PathStorage.str())); - llvm::sys::path::native("//net/file1", PathStorage); - expected_files.push_back(std::string(PathStorage.str())); llvm::sys::path::native("//net/dir/file3", PathStorage); expected_files.push_back(std::string(PathStorage.str())); + llvm::sys::path::native("//net/file1", PathStorage); + expected_files.push_back(std::string(PathStorage.str())); EXPECT_EQ(expected_files, getAllFiles(R"json( [ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits