laurens faceb864b8 Fix deleting of next line in user supplied inline function pattern
If we have a 'empty' macro, f.e.:
\#if <something>
\#define MY_LIBRARY_INLINE
\#endif
and using the user pattern 'MY_LIBRARY_INLINE', we would get the
following effect:
match = 'MY_LIBRARY_INLINE\n' <--- NOTE THAT THE NEWLINE IS PART OF THE MATCH
post-match = '#endif\n' <--- NO BEGINNING NEWLINE SINCE IT IS PART OF
THE MATCH ABOVE

And lead to the new header:
\#if <something>
Which gives a compilation error since the preprocessor-if is not
terminated properly.

The root cause is that we add a any-whitespace-character regex to the
user regex.
This any-whitespace-character regex was added only to cleanup the
 whitespaces after a user regex.

So the next line will be deleted if we check for any whitespace
character (THIS INCLUDES A NEWLINE!) after the user regex.
But this had the side effect that when matching a user regex, the newline was
also seen as part of the match. Which in the case of an empty macro
 would mean that in the cleanup of the post-match, we would delete the
 line immediately after the empty macro (\#endif in the example above).
So instead of matching with every whitespace character (which includes
newlines!), we explicitly only check for whitespaces.

Taking the example above, this has the desired effect:
match = 'MY_LIBRARY_INLINE' <--- NOTE THAT THE NEWLINE IS NO LONGER PART OF THE MATCH
post-match = '\n#endif\n' <--- BEGINNING NEWLINE NOW

Now the cleanup after a define will see the beginning newline in the
post-match and only remove that newline and now the preprocessor-if is
terminated properly
2020-01-14 22:18:17 +01:00
2019-11-12 18:27:33 -05:00
2018-11-13 21:11:15 -05:00

CMock - Mock/stub generator for C

CMock Build Status

Getting Started

If you're using Ceedling, there is no need to install CMock. It will handle it for you. For everyone else, the simplest way is to grab it off github. You can also download it as a zip if you prefer. The Github method looks something like this:

> git clone --recursive https://github.com/throwtheswitch/cmock.git
> cd cmock
> bundle install # Ensures you have all RubyGems needed

If you plan to help with the development of CMock (or just want to verify that it can perform its self tests on your system) then you can enter the test directory and then ask it to test:

> cd test
> rake # Run all CMock self tests

API Documentation

S
Description
Mirror of https://github.com/ThrowTheSwitch/CMock.git for ESP-IDF submodules
Readme 4.9 MiB
Languages
C 58.9%
Ruby 23.2%
Assembly 9.5%
Tcl 7.9%
Batchfile 0.4%