mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-23 03:29:57 +00:00
now ignoring contents of #pragma asm sections in header files, which were previously erroneously treated as C tokens
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@143 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -50,6 +50,9 @@ class CMockHeaderParser
|
||||
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
||||
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
||||
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
||||
|
||||
# remove assembler pragma sections
|
||||
source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
|
||||
|
||||
# remove preprocessor statements
|
||||
source.gsub!(/^\s*#.*/, '')
|
||||
|
||||
@@ -83,6 +83,21 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
|
||||
assert_equal(expected, @parser.import_source(source))
|
||||
end
|
||||
|
||||
|
||||
should "remove assembler pragma sections" do
|
||||
source =
|
||||
" #pragma\tasm\n" +
|
||||
" .foo\n" +
|
||||
" lda %m\n" +
|
||||
" nop\n" +
|
||||
"# pragma endasm \n" +
|
||||
"foo"
|
||||
|
||||
expected = ["foo"]
|
||||
|
||||
assert_equal(expected, @parser.import_source(source))
|
||||
end
|
||||
|
||||
|
||||
should "smush lines together that contain continuation characters" do
|
||||
@@ -527,4 +542,4 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
assert_equal(expected, @parser.parse(source)[:functions])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user