mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-14 04:47:26 +00:00
fix: Don't smush macros which have an escaped empty line at the end
nanopb has a habit of generating macros which end with an escaped empty line (for example for messages which are empty). They look like this: #define some_msg_t_FIELDLIST(X, a) \ #define some_msg_t_CALLBACK NULL This caused CMock to strip all of the newlines after the backslash instead of only one, which the backslash was escaping. This in turn caused both the macros to be in one line, causing a compile error in the generated mock.
This commit is contained in:
@@ -2867,5 +2867,19 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
||||
assert_equal(expected, @parser.transform_inline_functions(source))
|
||||
end
|
||||
|
||||
it "Transform macros with escapes of empty lines" do
|
||||
source =
|
||||
"#define some_msg_t_FIELDLIST(X, a) \\\n" +
|
||||
"\n" +
|
||||
"#define some_msg_t_CALLBACK NULL\n"
|
||||
|
||||
expected =
|
||||
"#define some_msg_t_FIELDLIST(X, a) \n" +
|
||||
"#define some_msg_t_CALLBACK NULL\n"
|
||||
|
||||
@parser.treat_inlines = :include
|
||||
assert_equal(expected, @parser.transform_inline_functions(source))
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user