aboutsummaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorJoseph Ates <joseph.ates@msasafety.com>2016-02-10 12:16:13 +0100
committerAndreas Schneider <asn@cryptomilk.org>2016-02-10 13:18:11 +0100
commitf8bba4b3a519147de59a2a7c3dc6262549e7e2bb (patch)
tree646f92fcc8b778916a6b380e06ab7bef2cb857da /tests/CMakeLists.txt
parentc971d6e5c26549c421d7fc4cc2965cea4c628866 (diff)
downloadcmocka-f8bba4b3a519147de59a2a7c3dc6262549e7e2bb.tar.gz
cmocka-f8bba4b3a519147de59a2a7c3dc6262549e7e2bb.tar.xz
cmocka-f8bba4b3a519147de59a2a7c3dc6262549e7e2bb.zip
cmocka: Add will_return_maybe() for ignoring mock returns
As both parameter and function call order checking allow for ignoring cases where they are never invoked, the mock return values are at somewhat of a mismatch in that they must always be returned at least once (even in the case of will_return_always()). Therefore, the ability to set the count to -2 on will_return_count was added with a new macro (will_return_maybe) that indicates that that the value field may never be returned and still allow a successful test. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 4b015ba..0422487 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -19,7 +19,9 @@ set(CMOCKA_TESTS
test_skip
test_setup_fail
test_ordering
- test_ordering_fail)
+ test_ordering_fail
+ test_returns
+ test_returns_fail)
foreach(_CMOCKA_TEST ${CMOCKA_TESTS})
add_cmocka_test(${_CMOCKA_TEST} ${_CMOCKA_TEST}.c ${CMOCKA_STATIC_LIBRARY})
@@ -33,7 +35,7 @@ add_cmocka_test(test_cmockery test_cmockery.c ${CMOCKA_STATIC_LIBRARY})
### Exceptions
-# test_assert_macros_fail
+# test_skip
set_tests_properties(
test_skip
PROPERTIES
@@ -57,6 +59,14 @@ set_tests_properties(
"\\[ FAILED \\] 7 test"
)
+# test_returns_fail ensure proper failures
+set_tests_properties(
+ test_returns_fail
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "\\[ FAILED \\] 3 test"
+)
+
# test_exception_handler
if (WIN32)
set_tests_properties(