aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Tooling/CompilationDatabaseTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r--clang/unittests/Tooling/CompilationDatabaseTest.cpp9
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(
[