Add tests for directive collections.

This commit is contained in:
ykiko
2024-12-07 16:50:26 +08:00
parent 6af1017d24
commit 1b7e5a6737
13 changed files with 414 additions and 157 deletions

View File

@@ -1,22 +1,42 @@
#include <gtest/gtest.h>
#include "Test.h"
#include <llvm/Support/CommandLine.h>
namespace clice {
llvm::cl::opt<std::string> test_dir_path("test-dir",
llvm::cl::desc("specify the test source directory path"),
llvm::cl::value_desc("path"),
llvm::cl::Required);
namespace cl {
std::string test_dir() {
return test_dir_path;
llvm::cl::opt<std::string> test_dir("test-dir",
llvm::cl::desc("specify the test source directory path"),
llvm::cl::value_desc("path"),
llvm::cl::Required);
llvm::SmallString<128> resource_dir;
} // namespace cl
namespace test {
llvm::StringRef source_dir() {
return cl::test_dir.getValue();
}
llvm::StringRef resource_dir() {
return cl::resource_dir.c_str();
}
} // namespace test
} // namespace clice
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
llvm::cl::ParseCommandLineOptions(argc, argv, "clice test\n");
if(auto error = clice::fs::real_path(llvm::Twine(argv[0]) + "/../../lib/clang/20)",
clice::cl::resource_dir)) {
llvm::errs() << "Failed to get resource directory, because " << error.message() << '\n';
}
return RUN_ALL_TESTS();
}