Add to verbosity of failures to find prototypes in headers.

This commit is contained in:
Mark VanderVoord
2024-02-21 13:52:07 -05:00
parent cac4907c27
commit 083bbd6a38
2 changed files with 9 additions and 9 deletions
+4 -4
View File
@@ -39,7 +39,7 @@ class CMockHeaderParser
function_names = []
all_funcs = parse_functions(import_source(source, parse_project)).map { |item| [item] }
all_funcs = parse_functions(name, import_source(source, parse_project)).map { |item| [item] }
all_funcs += parse_cpp_functions(import_source(source, parse_project, true))
all_funcs.map do |decl|
func = parse_declaration(parse_project, *decl)
@@ -358,15 +358,15 @@ class CMockHeaderParser
funcs
end
def parse_functions(source)
def parse_functions(filename, source)
funcs = []
source.each { |line| funcs << line.strip.gsub(/\s+/, ' ') if line =~ @declaration_parse_matcher }
if funcs.empty?
case @when_no_prototypes
when :error
raise 'ERROR: No function prototypes found!'
raise 'ERROR: No function prototypes found by CMock in #{filename}'
when :warn
puts 'WARNING: No function prototypes found!' unless @verbosity < 1
puts 'WARNING: No function prototypes found by CMock in #{filename}' unless @verbosity < 1
end
end
funcs
+5 -5
View File
@@ -383,7 +383,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
begin
@parser.parse("module", source)
rescue RuntimeError => e
assert_equal("ERROR: No function prototypes found!", e.message)
assert_match("ERROR: No function prototypes found", e.message)
end
end
@@ -407,7 +407,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
begin
@parser.parse("module", source)
rescue RuntimeError => e
assert_equal("ERROR: No function prototypes found!", e.message)
assert_match("ERROR: No function prototypes found", e.message)
end
end
@@ -435,7 +435,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
begin
@parser.parse("module", source)
rescue RuntimeError => e
assert_equal("ERROR: No function prototypes found!", e.message)
assert_match("ERROR: No function prototypes found", e.message)
end
end
@@ -676,7 +676,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
begin
@parser.parse("module", source)
rescue RuntimeError => e
assert_equal("ERROR: No function prototypes found!", e.message)
assert_match("ERROR: No function prototypes found", e.message)
end
end
@@ -705,7 +705,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
begin
@parser.parse("module", source)
rescue RuntimeError => e
assert_equal("ERROR: No function prototypes found!", e.message)
assert_match("ERROR: No function prototypes found", e.message)
end
end