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.
 
 

20 lines
502 B

#include "clangmm.h"
#include <cassert>
#include <string>
int main() {
std::string tests_path = LIBCLANGMM_TESTS_PATH;
std::string path(tests_path + "/case/main.cpp");
auto index = std::make_shared<clangmm::Index>(0, 0);
clangmm::TranslationUnit tu(index, path, {});
auto tokens = tu.get_tokens(0, 113);
assert(tokens->size() == 32);
assert((*tokens)[1].get_kind() == clangmm::Token::Kind::Identifier);
std::string str = (*tokens)[28].get_spelling();
assert(str == "return");
}