mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-12 14:17:53 +00:00
- CMock verbosity control
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@150 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
+2
-1
@@ -18,6 +18,7 @@ class CMock
|
||||
cm_gen_plugins = CMockPluginManager.new(cm_config, cm_gen_utils)
|
||||
@cm_parser = CMockHeaderParser.new(cm_config)
|
||||
@cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins)
|
||||
@silent = (cm_config.verbosity < 2)
|
||||
end
|
||||
|
||||
def setup_mocks(files)
|
||||
@@ -30,7 +31,7 @@ class CMock
|
||||
|
||||
def generate_mock(src)
|
||||
name = File.basename(src, '.h')
|
||||
puts "Creating mock for #{name}..."
|
||||
puts "Creating mock for #{name}..." unless @silent
|
||||
@cm_generator.create_mock(name, @cm_parser.parse(File.read(src)))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,7 @@ class CMockConfig
|
||||
:memcmp_if_unknown => true,
|
||||
:when_no_prototypes => :warn, #the options being :ignore, :warn, or :error
|
||||
:when_ptr =>:compare_data, #the options being :compare_ptr, :compare_data, or :smart
|
||||
:verbosity => 2, #0 errors only, #1 warnings and errors, #2 normal info, #3 verbose
|
||||
}
|
||||
|
||||
def initialize(options=nil)
|
||||
|
||||
@@ -10,6 +10,7 @@ class CMockHeaderParser
|
||||
@standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq
|
||||
@when_no_prototypes = cfg.when_no_prototypes
|
||||
@local_as_void = @treat_as_void
|
||||
@verbosity = cfg.verbosity
|
||||
end
|
||||
|
||||
def parse(source)
|
||||
@@ -94,7 +95,7 @@ class CMockHeaderParser
|
||||
when :error
|
||||
raise "ERROR: No function prototypes found!"
|
||||
when :warn
|
||||
puts "WARNING: No function prototypes found!"
|
||||
puts "WARNING: No function prototypes found!" unless (@verbosity < 1)
|
||||
end
|
||||
end
|
||||
return funcs
|
||||
|
||||
@@ -10,6 +10,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
@config.expect.treat_as_void.returns(['MY_FUNKY_VOID'])
|
||||
@config.expect.treat_as.returns({ "BANJOS" => "INT", "TUBAS" => "HEX16"} )
|
||||
@config.expect.when_no_prototypes.returns(:error)
|
||||
@config.expect.verbosity.returns(1)
|
||||
|
||||
@parser = CMockHeaderParser.new(@config)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user