diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2022-11-15 13:31:29 +0100 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2022-11-15 13:31:40 +0100 |
commit | eed1f337a1fbf8c1e7e53a6e1d0dfd4eb800aa08 (patch) | |
tree | 85118266c1a66a6d6a2fe3a69f438012d0969619 /clang/unittests/Tooling/CompilationDatabaseTest.cpp | |
parent | 2da67e8053c7320ed8774830b8fe1c0c4d7e7ebb (diff) | |
download | llvm-eed1f337a1fbf8c1e7e53a6e1d0dfd4eb800aa08.zip llvm-eed1f337a1fbf8c1e7e53a6e1d0dfd4eb800aa08.tar.gz llvm-eed1f337a1fbf8c1e7e53a6e1d0dfd4eb800aa08.tar.bz2 |
[clang][Tooling] Sort filenames in test
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 89763f9..fb8c10d 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( [ |