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