summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-02 08:56:28 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-04-02 08:56:28 -0400
commitde8993575c0a336e097d18c984252cb20d9f2f86 (patch)
tree0a05e29b86db4a164625f10259a905e40222f68c /src/tests
parent96a9791a5c04dec99da275ac516bf5cf48ef1296 (diff)
efl_check: add API to expect a error
Summary: sometimes it is not enough to just disable aborting on critical error messages. Sometimes it is better to explicitly expect an error, and fail the testcase if there is no error. This is used in later commits here. Depends on D8417 Reviewers: YOhoho, segfaultxavi, zmike, woohyun, Jaehyun_Cho Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8519
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/efl_check.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/efl_check.h b/src/tests/efl_check.h
index d5b0d2fcc2..e4f3e7a202 100644
--- a/src/tests/efl_check.h
+++ b/src/tests/efl_check.h
@@ -53,6 +53,20 @@
53 eina_log_abort_on_critical_set(___val); \ 53 eina_log_abort_on_critical_set(___val); \
54 } while (0) 54 } while (0)
55 55
56#define EXPECT_ERROR_START \
57 do { \
58 DISABLE_ABORT_ON_CRITICAL_START; \
59 Eina_Bool expect_error_start = EINA_FALSE; \
60 do { \
61 eina_log_print_cb_set(_efl_test_expect_error, &expect_error_start); \
62 } while(0)
63
64
65#define EXPECT_ERROR_END \
66 ck_assert_int_eq(expect_error_start, EINA_TRUE); \
67 DISABLE_ABORT_ON_CRITICAL_END; \
68 } while(0)
69
56typedef struct _Efl_Test_Case Efl_Test_Case; 70typedef struct _Efl_Test_Case Efl_Test_Case;
57struct _Efl_Test_Case 71struct _Efl_Test_Case
58{ 72{
@@ -62,6 +76,15 @@ struct _Efl_Test_Case
62 76
63static int timeout_pid = 0; 77static int timeout_pid = 0;
64 78
79EINA_UNUSED static void
80_efl_test_expect_error(const Eina_Log_Domain *d EINA_UNUSED, Eina_Log_Level level, const char *file EINA_UNUSED, const char *fnc, int line EINA_UNUSED, const char *fmt EINA_UNUSED, void *data, va_list args EINA_UNUSED)
81{
82 Eina_Bool *error = (Eina_Bool*) data;
83 if (level == EINA_LOG_LEVEL_ERR) *error = EINA_TRUE;
84
85 printf("EXPECTED ERROR %s\n", fnc);
86}
87
65static void 88static void
66_efl_tests_list(const Efl_Test_Case *etc) 89_efl_tests_list(const Efl_Test_Case *etc)
67{ 90{