From f63d8d78131593eb6099248e5a3b0805b39e63d0 Mon Sep 17 00:00:00 2001 From: ajwitte Date: Wed, 4 Nov 2009 16:51:31 +0000 Subject: [PATCH] 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 --- lib/cmock_generator.rb | 2 +- test/unit/cmock_generator_main_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cmock_generator.rb b/lib/cmock_generator.rb index e349b3f..5bd9ebe 100644 --- a/lib/cmock_generator.rb +++ b/lib/cmock_generator.rb @@ -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" diff --git a/test/unit/cmock_generator_main_test.rb b/test/unit/cmock_generator_main_test.rb index 712493e..0f55132 100644 --- a/test/unit/cmock_generator_main_test.rb +++ b/test/unit/cmock_generator_main_test.rb @@ -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" +