[clang][Tooling] Sort filenames in test

This commit is contained in:
Kadir Cetinkaya 2022-11-15 13:31:29 +01:00
parent 2da67e8053
commit eed1f337a1
No known key found for this signature in database
GPG Key ID: E39E36B8D2057ED6
1 changed files with 6 additions and 3 deletions

View File

@ -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(
[