@ -9,10 +9,10 @@ std::string main_error = R"(int main() {
}
}
) " ;
) " ;
//Requires display server to work
// Requires display server to work
//However, it is possible to use the Broadway backend if the test is run in a pure terminal environment:
// However, it is possible to use the Broadway backend if the test is run in a pure terminal environment:
//broadwayd&
// broadwayd&
//make test
// make test
void flush_events ( ) {
void flush_events ( ) {
while ( Gtk : : Main : : events_pending ( ) )
while ( Gtk : : Main : : events_pending ( ) )
@ -40,7 +40,7 @@ int main() {
flush_events ( ) ;
flush_events ( ) ;
g_assert_cmpuint ( clang_view - > clang_diagnostics . size ( ) , = = , 0 ) ;
g_assert_cmpuint ( clang_view - > clang_diagnostics . size ( ) , = = , 0 ) ;
//test get_declaration and get_implementation
// test get_declaration and get_implementation
clang_view - > place_cursor_at_line_index ( 15 , 7 ) ;
clang_view - > place_cursor_at_line_index ( 15 , 7 ) ;
auto locations = clang_view - > get_declaration_locations ( ) ;
auto locations = clang_view - > get_declaration_locations ( ) ;
g_assert ( locations . size ( ) = = 1 ) ;
g_assert ( locations . size ( ) = = 1 ) ;
@ -56,7 +56,7 @@ int main() {
g_assert ( locations . size ( ) = = 1 ) ;
g_assert ( locations . size ( ) = = 1 ) ;
g_assert_cmpuint ( locations [ 0 ] . line , = = , 6 ) ;
g_assert_cmpuint ( locations [ 0 ] . line , = = , 6 ) ;
//test get_usages and get_methods
// test get_usages and get_methods
{
{
auto locations = clang_view - > get_usages ( ) ;
auto locations = clang_view - > get_usages ( ) ;
g_assert_cmpuint ( locations . size ( ) , > , 0 ) ;
g_assert_cmpuint ( locations . size ( ) , > , 0 ) ;
@ -65,7 +65,7 @@ int main() {
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 ( 0 , 6 ) ;
clang_view - > place_cursor_at_line_index ( 0 , 6 ) ;
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 ( ) ) ;
@ -84,7 +84,7 @@ int main() {
clang_view - > get_buffer ( ) - > set_text ( saved_main ) ;
clang_view - > get_buffer ( ) - > set_text ( saved_main ) ;
clang_view - > save ( ) ;
clang_view - > save ( ) ;
//test error
// test error
clang_view - > get_buffer ( ) - > set_text ( main_error ) ;
clang_view - > get_buffer ( ) - > set_text ( main_error ) ;
while ( ! clang_view - > parsed )
while ( ! clang_view - > parsed )
flush_events ( ) ;
flush_events ( ) ;