mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-05 18:57:50 +00:00
Friendler failure message if a mock is unable to allocate memory for itself (which is likely to happen if your production environment has no heap and you neglect to define one for your test environment)
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@144 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -110,7 +110,7 @@ class CMockGenerator
|
||||
|
||||
def create_mock_verify_function(file, functions)
|
||||
file << "void #{@mock_name}_Verify(void)\n{\n"
|
||||
file << " TEST_ASSERT_EQUAL(0, Mock.allocFailure);\n"
|
||||
file << " TEST_ASSERT_EQUAL_MESSAGE(0, Mock.allocFailure, \"Unable to allocate memory for mock\");\n"
|
||||
file << functions.collect {|function| @plugins.run(:mock_verify, function)}.join
|
||||
if (@ordered)
|
||||
file << " if (GlobalOrderError)\n"
|
||||
|
||||
@@ -207,7 +207,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
functions = []
|
||||
output = []
|
||||
expected = [ "void MockPoutPoutFish_Verify(void)\n{\n",
|
||||
" TEST_ASSERT_EQUAL(0, Mock.allocFailure);\n",
|
||||
" TEST_ASSERT_EQUAL_MESSAGE(0, Mock.allocFailure, \"Unable to allocate memory for mock\");\n",
|
||||
"",
|
||||
"}\n\n"
|
||||
]
|
||||
@@ -223,7 +223,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
]
|
||||
output = []
|
||||
expected = [ "void MockPoutPoutFish_Verify(void)\n{\n",
|
||||
" TEST_ASSERT_EQUAL(0, Mock.allocFailure);\n",
|
||||
" TEST_ASSERT_EQUAL_MESSAGE(0, Mock.allocFailure, \"Unable to allocate memory for mock\");\n",
|
||||
" Uno_First" +
|
||||
" Dos_First" +
|
||||
" Uno_Second" +
|
||||
|
||||
Reference in New Issue
Block a user