mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-27 04:27:26 +00:00
- Added a couple more tests to our details test
- Added a gitattributes file to force line endings to be correct.
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
* text=auto
|
||||||
|
|
||||||
|
# These files are text and should be normalized (convert crlf to lf)
|
||||||
|
*.rb text
|
||||||
|
*.test text
|
||||||
|
*.c text
|
||||||
|
*.cpp text
|
||||||
|
*.h text
|
||||||
|
*.txt text
|
||||||
|
*.yml text
|
||||||
|
*.s79 text
|
||||||
|
*.bat text
|
||||||
|
*.xcl text
|
||||||
|
*.inc text
|
||||||
|
*.info text
|
||||||
|
*.md text
|
||||||
|
makefile text
|
||||||
|
rakefile text
|
||||||
|
|
||||||
|
|
||||||
|
#These files are binary and should not be normalized
|
||||||
|
*.doc binary
|
||||||
|
*.odt binary
|
||||||
|
*.pdf binary
|
||||||
|
*.ewd binary
|
||||||
|
*.eww binary
|
||||||
|
*.dni binary
|
||||||
|
*.wsdt binary
|
||||||
|
*.dbgdt binary
|
||||||
|
*.mac binary
|
||||||
@@ -4,7 +4,7 @@ class CMockGeneratorPluginReturnThruPtr
|
|||||||
|
|
||||||
def initialize(config, utils)
|
def initialize(config, utils)
|
||||||
@utils = utils
|
@utils = utils
|
||||||
@priority = 1
|
@priority = 1 #TODO: it's 1 to come before ignore_arg returns... but should be after expects otherwise (like 9)
|
||||||
end
|
end
|
||||||
|
|
||||||
def instance_typedefs(function)
|
def instance_typedefs(function)
|
||||||
|
|||||||
+1
-1
@@ -264,7 +264,7 @@ module RakefileHelpers
|
|||||||
# some tests have additional requirements to check for (checking the actual output message)
|
# some tests have additional requirements to check for (checking the actual output message)
|
||||||
if (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/)
|
if (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/)
|
||||||
total_failures += 1
|
total_failures += 1
|
||||||
failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}'"
|
failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}' but was '#{test_results[index]}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,10 +30,7 @@
|
|||||||
:header: |
|
:header: |
|
||||||
#include "CException.h"
|
#include "CException.h"
|
||||||
void function_a(void);
|
void function_a(void);
|
||||||
void function_b(void);
|
int function_b(void);
|
||||||
void function_c(void);
|
|
||||||
int function_d(void);
|
|
||||||
void function_e(void);
|
|
||||||
|
|
||||||
:code: |
|
:code: |
|
||||||
void function_a(void)
|
void function_a(void)
|
||||||
@@ -42,6 +39,13 @@
|
|||||||
no_args();
|
no_args();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int function_b(void)
|
||||||
|
{
|
||||||
|
POINT_T pt = { 1, 2 };
|
||||||
|
foo(&pt);
|
||||||
|
return (pt.x + pt.y);
|
||||||
|
}
|
||||||
|
|
||||||
:tests:
|
:tests:
|
||||||
:common: |
|
:common: |
|
||||||
#include "CException.h"
|
#include "CException.h"
|
||||||
@@ -269,4 +273,36 @@
|
|||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- :pass: FALSE
|
||||||
|
:should: 'not contain mock details in failed assertion after mock which threw a CException'
|
||||||
|
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
|
||||||
|
:code: |
|
||||||
|
test()
|
||||||
|
{
|
||||||
|
CEXCEPTION_T e;
|
||||||
|
bar_ExpectAndThrow(0x12);
|
||||||
|
|
||||||
|
Try {
|
||||||
|
function_a();
|
||||||
|
}
|
||||||
|
Catch(e) {}
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL_INT_MESSAGE(1,2,"CustomFail");
|
||||||
|
}
|
||||||
|
|
||||||
|
- :pass: FALSE
|
||||||
|
:should: 'not contain mock details in failed assertion after mock which used a return thru ptr'
|
||||||
|
#:verify_error: 'FAIL: Expected 3 Was 7. CustomFail' #TODO: put back in once ReturnThruPtr fixed
|
||||||
|
:code: |
|
||||||
|
test()
|
||||||
|
{
|
||||||
|
POINT_T pt1 = { 1, 2 };
|
||||||
|
POINT_T pt2 = { 3, 4 };
|
||||||
|
|
||||||
|
foo_Expect(&pt1);
|
||||||
|
foo_ReturnThruPtr_a(&pt2);
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL_INT(3, function_b());
|
||||||
|
}
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|||||||
Reference in New Issue
Block a user