Skip to content

Commit

Permalink
add unit tests proving strippables work.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandervoord committed Jun 6, 2014
1 parent a4a6751 commit a32b1e1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/unit/cmock_header_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
def setup
create_mocks :config
@test_name = 'test_file.h'
@config.expect.strippables.returns([])
@config.expect.strippables.returns(["STRIPPABLE"])
@config.expect.attributes.returns(['__ramfunc', 'funky_attrib', 'SQLITE_API'])
@config.expect.c_calling_conventions.returns(['__stdcall'])
@config.expect.treat_as_void.returns(['MY_FUNKY_VOID'])
Expand Down Expand Up @@ -84,6 +84,25 @@ def teardown
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
end

should "remove strippables from the beginning or end of function declarations" do
source =
"void* my_calloc(size_t, size_t) STRIPPABLE;\n" +
"void\n" +
" my_realloc(void*, size_t) STRIPPABLE;\n" +
"extern int\n" +
" my_printf (void *my_object, const char *my_format, ...)\n" +
" STRIPPABLE;\n" +
" void STRIPPABLE universal_handler ();\n"

expected =
[
"void* my_calloc(size_t, size_t)",
"void my_realloc(void*, size_t)",
"void universal_handler()"
]

assert_equal(expected, @parser.import_source(source))
end

should "remove gcc's function __attribute__'s" do
source =
Expand Down

0 comments on commit a32b1e1

Please sign in to comment.