mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-16 15:19:57 +00:00
add StopIgnore to new plugin
This commit is contained in:
@@ -273,4 +273,53 @@
|
||||
TEST_ASSERT_EQUAL(60, function(4, 5, 6));
|
||||
}
|
||||
|
||||
# StopIgnore
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'fail when function is called after ignore is stopped'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
bar_Ignore();
|
||||
foo_IgnoreAndReturn(10);
|
||||
function(0, 0, 0);
|
||||
bar_StopIgnore();
|
||||
function(0, 0, 0);
|
||||
}
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'delete expect after ignore is stopped'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
bar_Ignore();
|
||||
foo_ExpectAndReturn(0, 40);
|
||||
foo_ExpectAndReturn(0, 30);
|
||||
foo_ExpectAndReturn(0, 40);
|
||||
|
||||
foo_IgnoreAndReturn(20);
|
||||
foo_StopIgnore();
|
||||
|
||||
TEST_ASSERT_EQUAL(110, function(0, 0, 0)); // THIS SHOULD FAIL
|
||||
}
|
||||
|
||||
- :pass: TRUE
|
||||
:should: 'delete expected return values after ignore is stopped'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
bar_Ignore();
|
||||
foo_ExpectAndReturn(0, 40);
|
||||
foo_ExpectAndReturn(0, 30);
|
||||
foo_ExpectAndReturn(0, 40);
|
||||
|
||||
foo_IgnoreAndReturn(20);
|
||||
foo_StopIgnore();
|
||||
|
||||
foo_ExpectAndReturn(0, 50);
|
||||
foo_ExpectAndReturn(0, 30);
|
||||
foo_ExpectAndReturn(0, 40);
|
||||
TEST_ASSERT_EQUAL(120, function(0, 0, 0));
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
@@ -35,7 +35,8 @@ describe CMockGeneratorPluginIgnoreStateless, "Verify CMockGeneratorPluginIgnore
|
||||
|
||||
it "handle function declarations for functions without return values" do
|
||||
function = {:name => "Mold", :args_string => "void", :return => test_return[:void]}
|
||||
expected = "#define Mold_Ignore() Mold_CMockIgnore()\nvoid Mold_CMockIgnore(void);\n"
|
||||
expected = "#define Mold_Ignore() Mold_CMockIgnore()\nvoid Mold_CMockIgnore(void);\n" +
|
||||
"#define Mold_StopIgnore() Mold_CMockStopIgnore()\nvoid Mold_CMockStopIgnore(void);\n"
|
||||
returned = @cmock_generator_plugin_ignore_stateless.mock_function_declarations(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
@@ -43,7 +44,9 @@ describe CMockGeneratorPluginIgnoreStateless, "Verify CMockGeneratorPluginIgnore
|
||||
it "handle function declarations for functions that returns something" do
|
||||
function = {:name => "Fungus", :args_string => "void", :return => test_return[:string]}
|
||||
expected = "#define Fungus_IgnoreAndReturn(cmock_retval) Fungus_CMockIgnoreAndReturn(cmock_retval)\n"+
|
||||
"void Fungus_CMockIgnoreAndReturn(const char* cmock_to_return);\n"
|
||||
"void Fungus_CMockIgnoreAndReturn(const char* cmock_to_return);\n" +
|
||||
"#define Fungus_StopIgnore() Fungus_CMockStopIgnore()\n"+
|
||||
"void Fungus_CMockStopIgnore(void);\n"
|
||||
returned = @cmock_generator_plugin_ignore_stateless.mock_function_declarations(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
@@ -82,6 +85,10 @@ describe CMockGeneratorPluginIgnoreStateless, "Verify CMockGeneratorPluginIgnore
|
||||
expected = ["void Slime_CMockIgnore(void)\n",
|
||||
"{\n",
|
||||
" Mock.Slime_IgnoreBool = (char)1;\n",
|
||||
"}\n\n",
|
||||
"void Slime_CMockStopIgnore(void)\n",
|
||||
"{\n",
|
||||
" Mock.Slime_IgnoreBool = (char)0;\n",
|
||||
"}\n\n"
|
||||
].join
|
||||
returned = @cmock_generator_plugin_ignore_stateless.mock_interfaces(function)
|
||||
@@ -96,6 +103,10 @@ describe CMockGeneratorPluginIgnoreStateless, "Verify CMockGeneratorPluginIgnore
|
||||
" Mock.Slime_CallInstance = CMOCK_GUTS_NONE;\n",
|
||||
" Mock.Slime_FinalReturn = cmock_to_return;\n",
|
||||
" Mock.Slime_IgnoreBool = (char)1;\n",
|
||||
"}\n\n",
|
||||
"void Slime_CMockStopIgnore(void)\n",
|
||||
"{\n",
|
||||
" Mock.Slime_IgnoreBool = (char)0;\n",
|
||||
"}\n\n"
|
||||
].join
|
||||
returned = @cmock_generator_plugin_ignore_stateless.mock_interfaces(function)
|
||||
|
||||
Reference in New Issue
Block a user