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.
21 lines
504 B
21 lines
504 B
|
6 years ago
|
#include "clangmm.hpp"
|
||
|
8 years ago
|
#include <cassert>
|
||
|
8 years ago
|
#include <string>
|
||
|
8 years ago
|
|
||
|
|
int main() {
|
||
|
8 years ago
|
std::string tests_path = LIBCLANGMM_TESTS_PATH;
|
||
|
|
std::string path(tests_path + "/case/main.cpp");
|
||
|
8 years ago
|
|
||
|
7 years ago
|
auto index = std::make_shared<clangmm::Index>(0, 0);
|
||
|
8 years ago
|
|
||
|
|
clangmm::TranslationUnit tu(index, path, {});
|
||
|
8 years ago
|
|
||
|
|
auto tokens = tu.get_tokens(0, 113);
|
||
|
8 years ago
|
|
||
|
|
assert(tokens->size() == 32);
|
||
|
|
assert((*tokens)[1].get_kind() == clangmm::Token::Kind::Identifier);
|
||
|
|
|
||
|
|
std::string str = (*tokens)[28].get_spelling();
|
||
|
8 years ago
|
assert(str == "return");
|
||
|
8 years ago
|
}
|