-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪲 Added fail messages when using Expect for ExpectAndReturn or vice v…
…ersa. (see issue #462)
- Loading branch information
1 parent
7925641
commit 07a0e25
Showing
4 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
test/system/test_interactions/wrong_expect_and_return.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
:cmock: | ||
:plugins: | ||
- # none | ||
|
||
:systest: | ||
:types: | | ||
#define UINT32 unsigned int | ||
typedef signed int custom_type; | ||
:mockable: | | ||
UINT32 foo(custom_type a); | ||
UINT32 bar(void); | ||
UINT32 foo_varargs(custom_type a, ...); | ||
void do_it(void); | ||
void do_another(int i); | ||
:source: | ||
:header: | | ||
UINT32 function_a(int a); | ||
void function_b(void); | ||
UINT32 function_c(int a); | ||
void function_d(void); | ||
:code: | | ||
UINT32 function_a(int a) | ||
{ | ||
return foo((custom_type)a) + bar(); | ||
} | ||
void function_b(void) { } | ||
UINT32 function_c(int a) | ||
{ | ||
return foo_varargs((custom_type)a, "ignored", 5); | ||
} | ||
void function_d(void) | ||
{ | ||
do_it(); | ||
do_another(2); | ||
} | ||
:tests: | ||
:common: | | ||
void setUp(void) {} | ||
void tearDown(void) {} | ||
:units: | ||
- :pass: FALSE | ||
:should: 'successfully report using Expect instead of ExpectAndReturn with args' | ||
:code: | | ||
test() | ||
{ | ||
foo_Expect((custom_type)1); | ||
bar_ExpectAndReturn(2); | ||
function_a(1); | ||
} | ||
- :pass: FALSE | ||
:should: 'successfully report using Expect instead of ExpectAndReturn without args' | ||
:code: | | ||
test() | ||
{ | ||
foo_ExpectAndReturn((custom_type)1, 4); | ||
bar_Expect(); | ||
function_a(1); | ||
} | ||
- :pass: FALSE | ||
:should: 'successfully report using Expect instead of ExpectAndReturn with varargs' | ||
:code: | | ||
test() | ||
{ | ||
foo_varargs_Expect((custom_type)3); | ||
function_c(3); | ||
} | ||
- :pass: FALSE | ||
:should: 'successfully report using ExpectAndReturn instead of Expect with args' | ||
:code: | | ||
test() | ||
{ | ||
do_it_Expect(); | ||
do_another_ExpectAndReturn(2, 2); | ||
function_d(); | ||
} | ||
- :pass: FALSE | ||
:should: 'successfully report using ExpectAndReturn instead of Expect without args' | ||
:code: | | ||
test() | ||
{ | ||
do_it_ExpectAndReturn(6); | ||
do_another_Expect(2); | ||
function_d(); | ||
} | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters