Commit 8595859e authored by Ole Christian Eidheim's avatar Ole Christian Eidheim
Browse files

Fixed completion_string_test on Linux

parent 044d7b7a
#include "clangmm.h"
#include <string>
#include <cassert>
#include <regex>
int main() {
......@@ -14,8 +15,18 @@ int main() {
std::string tests_path=LIBCLANGMM_TESTS_PATH;
std::string path(tests_path+"/case/main.cpp");
std::vector<std::string> arguments;
auto clang_version_string=clangmm::to_string(clang_getClangVersion());
const static std::regex clang_version_regex("^[A-Za-z ]+([0-9.]+).*$");
std::smatch sm;
if(std::regex_match(clang_version_string, sm, clang_version_regex)) {
auto clang_version=sm[1].str();
arguments.emplace_back("-I/usr/lib64/clang/"+clang_version+"/include"); // For Fedora
clangmm::Index index(0, 0);
clangmm::TranslationUnit tu(index, path, {});
clangmm::TranslationUnit tu(index, path, arguments);
std::string buffer="#include <string>\n"
"int main(int argc, char *argv[]) {\n"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment