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