Blame SOURCES/0058-testsuite-add-test-not-reportable.patch

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