/
githubmirror
/
libreport
Обзор
Документация
Войти
/
githubmirror
/
libreport
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/sitem.at
63 строки
1 KB
Michal Fabik
tests: Fix leaks
22 сен 2020, 15:11
22 сен 2020, 15:11
ea648b8
Код
Авторство
О чём код?
# -*- Autotest -*- AT_BANNER([TextBuffer search]) ## -------------------------- ## ## compares two search items ## ## -------------------------- ## AT_TESTFUN([sitem_compare], [[ #include "internal_libreport.h" #include "search_item.h" #include <assert.h> /* comparing two items */ int test() { char text[] = "Some text"; GtkTextTagTable *table = gtk_text_tag_table_new(); GtkTextBuffer *buffer = gtk_text_buffer_new(table); gtk_text_buffer_insert_at_cursor(buffer, text, strlen(text)); GtkTextIter start; gtk_text_buffer_get_start_iter(buffer, &start); GtkTextIter end; gtk_text_buffer_get_end_iter(buffer, &end); int ret = -2; search_item_t *sitem1 = sitem_new( 0, buffer, NULL, //not needed, maybe we can remove it from the sitem struct? start, end ); search_item_t *sitem2 = sitem_new( //yes, it's the same, so it should return 0 0, buffer, NULL, //not needed, maybe we can remove it from the sitem struct? start, end ); ret = sitem_compare(sitem1, sitem2); g_clear_object(&buffer); g_clear_object(&table); g_free(sitem1); g_free(sitem2); return ret; } int main(void) { libreport_glib_init(); assert(test() == 0); return 0; } ]])