From 095336cfcca370a4d49e0d22049420019c72f25f Mon Sep 17 00:00:00 2001 From: Matej Habrnal Date: Thu, 4 Sep 2014 05:19:41 -0400 Subject: [LIBREPORT PATCH 58/93] testsuite: add test not-reportable Testing make_description to print not-reportable. --- tests/make_description.at | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/make_description.at b/tests/make_description.at index 87c1fd4..7415cf8 100644 --- a/tests/make_description.at +++ b/tests/make_description.at @@ -188,3 +188,41 @@ int main(int argc, char **argv) return 0; } ]]) + +## -------------- ## +## not_reportable ## +## -------------- ## + +AT_TESTFUN([not_reportable], +[[ + +#include "internal_libreport.h" +#include +int main(int argc, char **argv) +{ + g_verbose = 3; + + problem_data_t *pd = problem_data_new(); + + problem_data_add_text_noteditable(pd, FILENAME_NOT_REPORTABLE, "not-reportable"); + + char *description = make_description(pd, /*skipped names*/NULL, CD_MAX_TEXT_SIZE, + MAKEDESC_SHOW_URLS); + + char *expected = xasprintf("%s: %*s%s\n", + "Reported", 14 - strlen("Reported"), "", "cannot be reported"); + + if (strstr(description, expected) == NULL) + { + printf("E:\n'%s'\n\nC:\n'%s'\n", expected, description); + assert(!"The description for not-reportable do not matches the expected description"); + } + + free(description); + free(expected); + problem_data_free(pd); + + return 0; +} + +]]) -- 1.8.3.1