mirror of https://gitlab.com/cppit/libclangmm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
894 B
36 lines
894 B
|
8 years ago
|
#include "clangmm.h"
|
||
|
|
#include <string>
|
||
|
|
#include <cassert>
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
{
|
||
|
|
clangmm::CompletionChunk str("(", clangmm::CompletionChunk_LeftBrace);
|
||
|
|
|
||
|
|
assert(str.chunk == "(");
|
||
|
|
assert(str.kind == clangmm::CompletionChunk_LeftBrace);
|
||
|
|
}
|
||
|
|
|
||
|
|
{
|
||
|
|
std::string tests_path=LIBCLANGMM_TESTS_PATH;
|
||
|
|
std::string path(tests_path+"/case/main.cpp");
|
||
|
|
|
||
|
|
clangmm::Index index(0, 0);
|
||
|
|
clangmm::TranslationUnit tu(index, path, {});
|
||
|
|
|
||
|
|
std::string buffer="#include <string>\n"
|
||
|
|
"int main(int argc, char *argv[]) {\n"
|
||
|
|
"std::string str;\n"
|
||
|
|
"str.\n"
|
||
|
|
"return 0\n"
|
||
|
|
"}";
|
||
|
|
|
||
|
|
tu.reparse(buffer);
|
||
|
|
auto results=tu.get_code_completions(buffer, 4, 5);
|
||
|
|
|
||
|
|
auto str = results.get(0);
|
||
|
|
|
||
|
|
assert(str.get_num_chunks()>0);
|
||
|
|
assert(str.get_chunks().size()>0);
|
||
|
|
}
|
||
|
|
}
|