mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-07 02:39:58 +00:00
- made out of order call messages more clear.
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@194 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -174,10 +174,14 @@ class CMockGenerator
|
||||
file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = Mock.#{function[:name]}_CallInstance;\n"
|
||||
file << " Mock.#{function[:name]}_CallInstance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n"
|
||||
file << @plugins.run(:mock_implementation_precheck, function)
|
||||
file << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function '#{function[:name]}' called more times than expected\");\n"
|
||||
file << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function '#{function[:name]}' called more times than expected.\");\n"
|
||||
file << " cmock_line = cmock_call_instance->LineNumber;\n"
|
||||
if (@ordered)
|
||||
file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n"
|
||||
file << " if (cmock_call_instance->CallOrder > ++GlobalVerifyOrder)\n"
|
||||
file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called earlier than expected.\");"
|
||||
file << " if (cmock_call_instance->CallOrder < GlobalVerifyOrder)\n"
|
||||
file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");"
|
||||
# file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n"
|
||||
end
|
||||
file << @plugins.run(:mock_implementation, function)
|
||||
file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'fail because bar and foo called in reverse order'
|
||||
:verify_error: 'Out of order function calls'
|
||||
:verify_error: 'called earlier than expected'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
- :pass: FALSE
|
||||
:should: 'successfully catch errors during back to back ExpectAndReturn setup and mock calls'
|
||||
:verify_error: 'Out of order function calls'
|
||||
:verify_error: 'called earlier than expected'
|
||||
:code: |
|
||||
test()
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
|
||||
#no strict handling
|
||||
@config.expect.mock_prefix.returns("Mock")
|
||||
@config.expect.enforce_strict_ordering.returns(false)
|
||||
@config.expect.enforce_strict_ordering.returns(nil)
|
||||
@config.expect.framework.returns(:unity)
|
||||
@cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
|
||||
@cmock_generator.module_name = @module_name
|
||||
@@ -361,7 +361,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
" CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = Mock.SupaFunction_CallInstance;\n",
|
||||
" Mock.SupaFunction_CallInstance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n",
|
||||
" uno",
|
||||
" UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected\");\n",
|
||||
" UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n",
|
||||
" cmock_line = cmock_call_instance->LineNumber;\n",
|
||||
" dos",
|
||||
" tres",
|
||||
@@ -392,7 +392,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
" CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = Mock.SupaFunction_CallInstance;\n",
|
||||
" Mock.SupaFunction_CallInstance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n",
|
||||
" uno",
|
||||
" UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected\");\n",
|
||||
" UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"Function 'SupaFunction' called more times than expected.\");\n",
|
||||
" cmock_line = cmock_call_instance->LineNumber;\n",
|
||||
" dos",
|
||||
" tres",
|
||||
|
||||
Reference in New Issue
Block a user