|
|
|
@ -32,55 +32,44 @@ int main() { |
|
|
|
|
|
|
|
|
|
|
|
//test get_declaration and get_implementation
|
|
|
|
//test get_declaration and get_implementation
|
|
|
|
clang_view->place_cursor_at_line_index(14-1, 8-1); |
|
|
|
clang_view->place_cursor_at_line_index(14-1, 8-1); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
auto location=clang_view->get_declaration_location({clang_view}); |
|
|
|
auto location=clang_view->get_declaration_location({clang_view}); |
|
|
|
g_assert_cmpuint(location.line, ==, 5); |
|
|
|
g_assert_cmpuint(location.line, ==, 5); |
|
|
|
|
|
|
|
|
|
|
|
clang_view->place_cursor_at_line_index(location.line-1, location.index-1); |
|
|
|
clang_view->place_cursor_at_line_index(location.line-1, location.index-1); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
location=clang_view->get_implementation_location({clang_view}); |
|
|
|
location=clang_view->get_implementation_location({clang_view}); |
|
|
|
g_assert_cmpuint(location.line, ==, 10); |
|
|
|
g_assert_cmpuint(location.line, ==, 10); |
|
|
|
|
|
|
|
|
|
|
|
clang_view->place_cursor_at_line_index(location.line-1, location.index-1); |
|
|
|
clang_view->place_cursor_at_line_index(location.line-1, location.index-1); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
location=clang_view->get_declaration_location({clang_view}); |
|
|
|
location=clang_view->get_declaration_location({clang_view}); |
|
|
|
g_assert_cmpuint(location.line, ==, 5); |
|
|
|
g_assert_cmpuint(location.line, ==, 5); |
|
|
|
|
|
|
|
|
|
|
|
//test get_usages and get_methods
|
|
|
|
//test get_usages and get_methods
|
|
|
|
auto locations=clang_view->get_usages({clang_view}); |
|
|
|
auto locations=clang_view->get_usages({clang_view}); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
g_assert_cmpuint(locations.size(), >, 0); |
|
|
|
g_assert_cmpuint(locations.size(), >, 0); |
|
|
|
|
|
|
|
|
|
|
|
locations=clang_view->get_methods(); |
|
|
|
locations=clang_view->get_methods(); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
g_assert_cmpuint(locations.size(), >, 0); |
|
|
|
g_assert_cmpuint(locations.size(), >, 0); |
|
|
|
|
|
|
|
|
|
|
|
//Test rename class (error if not constructor and destructor is renamed as well)
|
|
|
|
//Test rename class (error if not constructor and destructor is renamed as well)
|
|
|
|
auto saved_main=clang_view->get_buffer()->get_text(); |
|
|
|
auto saved_main=clang_view->get_buffer()->get_text(); |
|
|
|
clang_view->place_cursor_at_line_index(1-1, 7-1); |
|
|
|
clang_view->place_cursor_at_line_index(1-1, 7-1); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
auto token=clang_view->get_token(clang_view->get_buffer()->get_insert()->get_iter()); |
|
|
|
auto token=clang_view->get_token(clang_view->get_buffer()->get_insert()->get_iter()); |
|
|
|
g_assert_cmpstr(token.c_str(), ==, "TestClass"); |
|
|
|
g_assert_cmpstr(token.c_str(), ==, "TestClass"); |
|
|
|
location=clang_view->get_declaration_location({clang_view}); |
|
|
|
location=clang_view->get_declaration_location({clang_view}); |
|
|
|
g_assert_cmpuint(location.line, ==, 1); |
|
|
|
g_assert_cmpuint(location.line, ==, 1); |
|
|
|
clang_view->rename_similar_tokens({clang_view}, "RenamedTestClass"); |
|
|
|
clang_view->rename_similar_tokens({clang_view}, "RenamedTestClass"); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
while(!clang_view->parsed) |
|
|
|
while(!clang_view->parsed) |
|
|
|
flush_events(); |
|
|
|
flush_events(); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
auto iter=clang_view->get_buffer()->get_insert()->get_iter(); |
|
|
|
auto iter=clang_view->get_buffer()->get_insert()->get_iter(); |
|
|
|
iter.backward_char(); |
|
|
|
iter.backward_char(); |
|
|
|
token=clang_view->get_token(iter); |
|
|
|
token=clang_view->get_token(iter); |
|
|
|
g_assert_cmpstr(token.c_str(), ==, "RenamedTestClass"); |
|
|
|
g_assert_cmpstr(token.c_str(), ==, "RenamedTestClass"); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
g_assert_cmpuint(clang_view->diagnostics.size(), ==, 0); |
|
|
|
g_assert_cmpuint(clang_view->diagnostics.size(), ==, 0); |
|
|
|
clang_view->get_buffer()->set_text(saved_main); |
|
|
|
clang_view->get_buffer()->set_text(saved_main); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
clang_view->save({clang_view}); |
|
|
|
clang_view->save({clang_view}); |
|
|
|
|
|
|
|
|
|
|
|
//test error
|
|
|
|
//test error
|
|
|
|
clang_view->get_buffer()->set_text(main_error); |
|
|
|
clang_view->get_buffer()->set_text(main_error); |
|
|
|
flush_events(); |
|
|
|
|
|
|
|
while(!clang_view->parsed) |
|
|
|
while(!clang_view->parsed) |
|
|
|
flush_events(); |
|
|
|
flush_events(); |
|
|
|
g_assert_cmpuint(clang_view->diagnostics.size(), >, 0); |
|
|
|
g_assert_cmpuint(clang_view->diagnostics.size(), >, 0); |
|
|
|
|