Skip to content

Commit 083bbd6

Browse files
committed
Add to verbosity of failures to find prototypes in headers.
1 parent cac4907 commit 083bbd6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/cmock_header_parser.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def parse(name, source)
3939

4040
function_names = []
4141

42-
all_funcs = parse_functions(import_source(source, parse_project)).map { |item| [item] }
42+
all_funcs = parse_functions(name, import_source(source, parse_project)).map { |item| [item] }
4343
all_funcs += parse_cpp_functions(import_source(source, parse_project, true))
4444
all_funcs.map do |decl|
4545
func = parse_declaration(parse_project, *decl)
@@ -358,15 +358,15 @@ def parse_cpp_functions(source)
358358
funcs
359359
end
360360

361-
def parse_functions(source)
361+
def parse_functions(filename, source)
362362
funcs = []
363363
source.each { |line| funcs << line.strip.gsub(/\s+/, ' ') if line =~ @declaration_parse_matcher }
364364
if funcs.empty?
365365
case @when_no_prototypes
366366
when :error
367-
raise 'ERROR: No function prototypes found!'
367+
raise 'ERROR: No function prototypes found by CMock in #{filename}'
368368
when :warn
369-
puts 'WARNING: No function prototypes found!' unless @verbosity < 1
369+
puts 'WARNING: No function prototypes found by CMock in #{filename}' unless @verbosity < 1
370370
end
371371
end
372372
funcs

test/unit/cmock_header_parser_test.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@
383383
begin
384384
@parser.parse("module", source)
385385
rescue RuntimeError => e
386-
assert_equal("ERROR: No function prototypes found!", e.message)
386+
assert_match("ERROR: No function prototypes found", e.message)
387387
end
388388
end
389389

@@ -407,7 +407,7 @@
407407
begin
408408
@parser.parse("module", source)
409409
rescue RuntimeError => e
410-
assert_equal("ERROR: No function prototypes found!", e.message)
410+
assert_match("ERROR: No function prototypes found", e.message)
411411
end
412412
end
413413

@@ -435,7 +435,7 @@
435435
begin
436436
@parser.parse("module", source)
437437
rescue RuntimeError => e
438-
assert_equal("ERROR: No function prototypes found!", e.message)
438+
assert_match("ERROR: No function prototypes found", e.message)
439439
end
440440
end
441441

@@ -676,7 +676,7 @@
676676
begin
677677
@parser.parse("module", source)
678678
rescue RuntimeError => e
679-
assert_equal("ERROR: No function prototypes found!", e.message)
679+
assert_match("ERROR: No function prototypes found", e.message)
680680
end
681681
end
682682

@@ -705,7 +705,7 @@
705705
begin
706706
@parser.parse("module", source)
707707
rescue RuntimeError => e
708-
assert_equal("ERROR: No function prototypes found!", e.message)
708+
assert_match("ERROR: No function prototypes found", e.message)
709709
end
710710
end
711711

0 commit comments

Comments
 (0)